当前位置: 首页>>代码示例>>Java>>正文


Java UpmsRole类代码示例

本文整理汇总了Java中com.zheng.upms.dao.model.UpmsRole的典型用法代码示例。如果您正苦于以下问题:Java UpmsRole类的具体用法?Java UpmsRole怎么用?Java UpmsRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

UpmsRole类属于com.zheng.upms.dao.model包,在下文中一共展示了UpmsRole类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: list

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
@ApiOperation(value = "角色列表")
@RequiresPermissions("upms:role: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, value = "sort") String sort,
        @RequestParam(required = false, value = "order") String order) {
    UpmsRoleExample upmsRoleExample = new UpmsRoleExample();
    if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
        upmsRoleExample.setOrderByClause(sort + " " + order);
    }
    if (StringUtils.isNotBlank(search)) {
        upmsRoleExample.or()
                .andTitleLike("%" + search + "%");
    }
    List<UpmsRole> rows = upmsRoleService.selectByExampleForOffsetPage(upmsRoleExample, offset, limit);
    long total = upmsRoleService.countByExample(upmsRoleExample);
    Map<String, Object> result = new HashMap<>();
    result.put("rows", rows);
    result.put("total", total);
    return result;
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:26,代码来源:UpmsRoleController.java


示例2: create

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
@ApiOperation(value = "新增角色")
@RequiresPermissions("upms:role:create")
@ResponseBody
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Object create(UpmsRole upmsRole) {
    ComplexResult result = FluentValidator.checkAll()
            .on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
            .on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
            .doValidate()
            .result(ResultCollectors.toComplex());
    if (!result.isSuccess()) {
        return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
    }
    long time = System.currentTimeMillis();
    upmsRole.setCtime(time);
    upmsRole.setOrders(time);
    int count = upmsRoleService.insertSelective(upmsRole);
    return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:20,代码来源:UpmsRoleController.java


示例3: update

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
@ApiOperation(value = "修改角色")
@RequiresPermissions("upms:role:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, UpmsRole upmsRole) {
    ComplexResult result = FluentValidator.checkAll()
            .on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
            .on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
            .doValidate()
            .result(ResultCollectors.toComplex());
    if (!result.isSuccess()) {
        return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
    }
    upmsRole.setRoleId(id);
    int count = upmsRoleService.updateByPrimaryKeySelective(upmsRole);
    return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:18,代码来源:UpmsRoleController.java


示例4: permission

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
@ApiOperation(value = "角色权限")
@RequiresPermissions("upms:role:permission")
@RequestMapping(value = "/permission/{id}", method = RequestMethod.GET)
public String permission(@PathVariable("id") int id, ModelMap modelMap) {
    UpmsRole role = upmsRoleService.selectByPrimaryKey(id);
    modelMap.put("role", role);
    return "/manage/role/permission.jsp";
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:9,代码来源:UpmsRoleController.java


示例5: doGetAuthorizationInfo

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的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;
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:34,代码来源:UpmsRealm.java


示例6: insert

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
int insert(UpmsRole record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例7: insertSelective

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
int insertSelective(UpmsRole record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例8: selectByExample

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
List<UpmsRole> selectByExample(UpmsRoleExample example); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例9: selectByPrimaryKey

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
UpmsRole selectByPrimaryKey(Integer roleId); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例10: updateByExampleSelective

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
int updateByExampleSelective(@Param("record") UpmsRole record, @Param("example") UpmsRoleExample example); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例11: updateByExample

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
int updateByExample(@Param("record") UpmsRole record, @Param("example") UpmsRoleExample example); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例12: updateByPrimaryKeySelective

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
int updateByPrimaryKeySelective(UpmsRole record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例13: updateByPrimaryKey

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
int updateByPrimaryKey(UpmsRole record); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsRoleMapper.java


示例14: selectUpmsRoleByUpmsUserId

import com.zheng.upms.dao.model.UpmsRole; //导入依赖的package包/类
List<UpmsRole> selectUpmsRoleByUpmsUserId(Integer upmsUserId); 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:2,代码来源:UpmsApiMapper.java



注:本文中的com.zheng.upms.dao.model.UpmsRole类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。