本文整理汇总了Java中com.zheng.upms.dao.model.UpmsPermission类的典型用法代码示例。如果您正苦于以下问题:Java UpmsPermission类的具体用法?Java UpmsPermission怎么用?Java UpmsPermission使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UpmsPermission类属于com.zheng.upms.dao.model包,在下文中一共展示了UpmsPermission类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
@ApiOperation(value = "新增权限")
@RequiresPermissions("upms:permission:create")
@ResponseBody
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Object create(UpmsPermission upmsPermission) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsPermission.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
upmsPermission.setCtime(time);
upmsPermission.setOrders(time);
int count = upmsPermissionService.insertSelective(upmsPermission);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
示例2: update
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
@ApiOperation(value = "修改权限")
@RequiresPermissions("upms:permission:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, UpmsPermission upmsPermission) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsPermission.getName(), new LengthValidator(1, 20, "名称"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
upmsPermission.setPermissionId(id);
int count = upmsPermissionService.updateByPrimaryKeySelective(upmsPermission);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
示例3: doGetAuthorizationInfo
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
/**
* 授权:验证权限时调用
* @param principalCollection
* @return
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
String username = (String) principalCollection.getPrimaryPrincipal();
UpmsUser upmsUser = upmsApiService.selectUpmsUserByUsername(username);
// 当前用户所有角色
List<UpmsRole> upmsRoles = upmsApiService.selectUpmsRoleByUpmsUserId(upmsUser.getUserId());
Set<String> roles = new HashSet<>();
for (UpmsRole upmsRole : upmsRoles) {
if (StringUtils.isNotBlank(upmsRole.getName())) {
roles.add(upmsRole.getName());
}
}
// 当前用户所有权限
List<UpmsPermission> upmsPermissions = upmsApiService.selectUpmsPermissionByUpmsUserId(upmsUser.getUserId());
Set<String> permissions = new HashSet<>();
for (UpmsPermission upmsPermission : upmsPermissions) {
if (StringUtils.isNotBlank(upmsPermission.getPermissionValue())) {
permissions.add(upmsPermission.getPermissionValue());
}
}
SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo();
simpleAuthorizationInfo.setStringPermissions(permissions);
simpleAuthorizationInfo.setRoles(roles);
return simpleAuthorizationInfo;
}
示例4: list
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
@ApiOperation(value = "权限列表")
@RequiresPermissions("upms:permission:read")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, defaultValue = "0", value = "type") int type,
@RequestParam(required = false, defaultValue = "0", value = "systemId") int systemId,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsPermissionExample upmsPermissionExample = new UpmsPermissionExample();
UpmsPermissionExample.Criteria criteria = upmsPermissionExample.createCriteria();
if (0 != type) {
criteria.andTypeEqualTo((byte) type);
}
if (0 != systemId) {
criteria.andSystemIdEqualTo(systemId);
}
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsPermissionExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsPermissionExample.or()
.andNameLike("%" + search + "%");
}
List<UpmsPermission> rows = upmsPermissionService.selectByExampleForOffsetPage(upmsPermissionExample, offset, limit);
long total = upmsPermissionService.countByExample(upmsPermissionExample);
Map<String, Object> result = new HashMap<>();
result.put("rows", rows);
result.put("total", total);
return result;
}
示例5: insert
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
int insert(UpmsPermission record);
示例6: insertSelective
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
int insertSelective(UpmsPermission record);
示例7: selectByExample
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
List<UpmsPermission> selectByExample(UpmsPermissionExample example);
示例8: selectByPrimaryKey
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
UpmsPermission selectByPrimaryKey(Integer permissionId);
示例9: updateByExampleSelective
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
int updateByExampleSelective(@Param("record") UpmsPermission record, @Param("example") UpmsPermissionExample example);
示例10: updateByExample
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
int updateByExample(@Param("record") UpmsPermission record, @Param("example") UpmsPermissionExample example);
示例11: updateByPrimaryKeySelective
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
int updateByPrimaryKeySelective(UpmsPermission record);
示例12: updateByPrimaryKey
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
int updateByPrimaryKey(UpmsPermission record);
示例13: selectUpmsPermissionByUpmsUserId
import com.zheng.upms.dao.model.UpmsPermission; //导入依赖的package包/类
List<UpmsPermission> selectUpmsPermissionByUpmsUserId(Integer upmsUserId);