Exemplo n.º 1
0
  public Page<SysRole> findPageBy(int pageNo, int pageSize) {
    long total = sysroleMapper.count();
    PageRequest pageRequest = new PageRequest(pageNo, pageSize, Sort.Direction.ASC, "id");
    List<SysRole> list = sysroleMapper.findByPage((pageNo - 1) * pageSize, pageSize);
    Page<SysRole> page = new PageImpl<SysRole>(list, pageRequest, total);

    return page;
  }
Exemplo n.º 2
0
  @Transactional(readOnly = false)
  public int deleteSysRole(SysRoleView sysrole) {
    // 判断是否有用户使用该角色
    int count = sysroleMapper.findUserCount(sysrole);
    if (count > 0) return -1; // 有用户使用该角色,代表不能删除该角色

    sysrole.setModifyuser(ShiroDbRealm.getCurrentLoginName());
    sysroleMapper.deleteRoleFunction(sysrole);
    sysroleMapper.delete(sysrole);
    return 1;
  }
Exemplo n.º 3
0
 @Transactional(readOnly = false)
 public void updatePower(SysRoleView sysrole) {
   sysrole.setCreateuser(ShiroDbRealm.getCurrentLoginName());
   for (SysFunctionView sysFunction : sysrole.getFunctions()) {
     sysFunction.setRole_function_id(IdUtils.uuid2());
   }
   SysRole sys = sysroleMapper.findOne(sysrole.getId());
   if (sys != null && !sys.getRoleName().equals(sysrole.getRoleName())) {
     sys.setRoleName(sysrole.getRoleName());
     sys.setModifyuser(ShiroDbRealm.getCurrentLoginName());
     sysroleMapper.update(sys);
   }
   sysroleMapper.deleteRoleFunction(sysrole);
   sysroleMapper.insertRoleFunction(sysrole);
 }
Exemplo n.º 4
0
 @Transactional(readOnly = false)
 public void saveSysRole(SysRole sysrole) {
   sysrole.setId(IdUtils.uuid2());
   sysrole.setCreateuser(ShiroDbRealm.getCurrentLoginName());
   sysrole.setDeleteflag(AppConstants.IS_STATUS_DEFAULT);
   sysroleMapper.insert(sysrole);
 }
Exemplo n.º 5
0
 @Transactional(readOnly = false)
 public void updateSysRole(SysRole sysrole) {
   sysrole.setModifyuser(ShiroDbRealm.getCurrentLoginName());
   sysroleMapper.update(sysrole);
 }
Exemplo n.º 6
0
 public List<Map<String, Object>> getRoles() {
   return sysroleMapper.getRoles();
 }
Exemplo n.º 7
0
 public SysRole getSysRole(String id) {
   return sysroleMapper.findOne(id);
 }