merge
This commit is contained in:
@@ -74,6 +74,25 @@ public class CommonEnum {
|
||||
}
|
||||
}
|
||||
|
||||
public enum MenuOrButtonEnum {
|
||||
MENU("菜单", 1), BUTTON("按钮", 2);
|
||||
private int code;
|
||||
private String name;
|
||||
|
||||
MenuOrButtonEnum(String name, int code) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String code = "Y";
|
||||
// for (YesOrNoEnum yesOrNoEnum : YesOrNoEnum.values()) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.hibernate.validator.constraints.NotBlank;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明: 用户
|
||||
@@ -63,4 +64,6 @@ public class SysUser extends BaseEntity {
|
||||
private transient String create;
|
||||
private transient String modified;
|
||||
private transient String sexName;
|
||||
private transient List<SysAuthority> menuArray;
|
||||
private transient List<SysAuthority> otherArray;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xwbing.entity.vo;
|
||||
|
||||
import com.xwbing.entity.SysAuthority;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 15:43
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
@Data
|
||||
public class SysAuthVo extends SysAuthority {
|
||||
private static final long serialVersionUID = 2292744062645600313L;
|
||||
|
||||
public SysAuthVo() {
|
||||
}
|
||||
|
||||
public SysAuthVo(SysAuthority orig) {
|
||||
try {
|
||||
BeanUtils.copyProperties(this, orig);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private List<SysAuthVo> children;
|
||||
}
|
||||
@@ -3,11 +3,21 @@ package com.xwbing.repository;
|
||||
import com.xwbing.entity.SysAuthority;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/5/5 16:44
|
||||
* 作者: xiangwb
|
||||
*/
|
||||
public interface SysAuthorityRepository extends JpaRepository<SysAuthority,String> {
|
||||
public interface SysAuthorityRepository extends JpaRepository<SysAuthority, String> {
|
||||
SysAuthority getByCode(String code);
|
||||
|
||||
List<SysAuthority> getByEnable(String enable);
|
||||
|
||||
List<SysAuthority> getByParentIdAndEnable(String parentId, String enable);
|
||||
|
||||
List<SysAuthority> getByEnableAndIdIn(String enable, List<String> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xwbing.repository;
|
||||
|
||||
import com.xwbing.entity.SysRoleAuthority;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 15:13
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
public interface SysRoleAuthorityRepository extends JpaRepository<SysRoleAuthority, String> {
|
||||
List<SysRoleAuthority> getByRoleId(String roleId);
|
||||
}
|
||||
@@ -15,4 +15,6 @@ public interface SysRoleRepository extends JpaRepository<SysRole, String> {
|
||||
List<SysRole> getByEnable(String enable);
|
||||
|
||||
SysRole getByCode(String code);
|
||||
|
||||
List<SysRole> getByEnableAndIdIn(String enable,List<String> ids);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xwbing.repository;
|
||||
|
||||
import com.xwbing.entity.SysUserRole;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 14:13
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
public interface SysUserRoleRepository extends JpaRepository<SysUserRole, String> {
|
||||
List<SysUserRole> getByUserId(String userId);
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package com.xwbing.service;
|
||||
|
||||
import com.xwbing.constant.CommonConstant;
|
||||
import com.xwbing.entity.SysAuthority;
|
||||
import com.xwbing.entity.SysRoleAuthority;
|
||||
import com.xwbing.entity.vo.SysAuthVo;
|
||||
import com.xwbing.exception.BusinessException;
|
||||
import com.xwbing.repository.SysAuthorityRepository;
|
||||
import com.xwbing.util.PassWordUtil;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 13:20
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
@Service
|
||||
public class SysAuthorityService {
|
||||
@Resource
|
||||
private SysAuthorityRepository sysAuthorityRepository;
|
||||
@Resource
|
||||
private SysRoleAuthorityService sysRoleAuthorityService;
|
||||
|
||||
/**
|
||||
* 保存权限
|
||||
*
|
||||
* @param sysAuthority
|
||||
* @return
|
||||
*/
|
||||
public RestMessage save(SysAuthority sysAuthority) {
|
||||
RestMessage result = new RestMessage();
|
||||
boolean b = uniqueCode(sysAuthority.getCode(), "");
|
||||
if (!b)
|
||||
throw new BusinessException("该编码已存在");
|
||||
String id = PassWordUtil.createId();
|
||||
sysAuthority.setId(id);
|
||||
sysAuthority.setCreateTime(new Date());
|
||||
if (StringUtils.isEmpty(sysAuthority.getParentId()))
|
||||
sysAuthority.setParentId(CommonConstant.ROOT);
|
||||
SysAuthority save = sysAuthorityRepository.save(sysAuthority);
|
||||
if (save != null) {
|
||||
result.setSuccess(true);
|
||||
result.setId(id);
|
||||
result.setMessage("保存权限成功");
|
||||
} else {
|
||||
result.setMessage("保存权限失败");
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除权限
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public RestMessage removeById(String id) {
|
||||
RestMessage result = new RestMessage();
|
||||
SysAuthority one = getById(id);
|
||||
if (one == null)
|
||||
throw new BusinessException("该权限不存在");
|
||||
sysAuthorityRepository.delete(id);
|
||||
result.setMessage("删除成功");
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改权限
|
||||
*
|
||||
* @param sysAuthority
|
||||
* @return
|
||||
*/
|
||||
public RestMessage update(SysAuthority sysAuthority) {
|
||||
RestMessage result = new RestMessage();
|
||||
String id = sysAuthority.getId();
|
||||
SysAuthority old = getById(id);
|
||||
if (old == null)
|
||||
throw new BusinessException("该权限不存在");
|
||||
boolean b = uniqueCode(sysAuthority.getCode(), id);
|
||||
if (!b)
|
||||
throw new BusinessException("该编码已存在");
|
||||
old.setName(sysAuthority.getName());
|
||||
old.setCode(sysAuthority.getCode());
|
||||
old.setEnable(sysAuthority.getEnable());
|
||||
old.setUrl(sysAuthority.getUrl());
|
||||
old.setType(sysAuthority.getType());
|
||||
SysAuthority save = sysAuthorityRepository.save(old);
|
||||
if (save != null) {
|
||||
result.setSuccess(true);
|
||||
result.setId(id);
|
||||
result.setMessage("修改权限成功");
|
||||
} else {
|
||||
result.setMessage("修改权限失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键查找
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public SysAuthority getById(String id) {
|
||||
return sysAuthorityRepository.findOne(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态获取所有权限
|
||||
*
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> listByEnable(String enable) {
|
||||
return sysAuthorityRepository.getByEnable(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有子节点
|
||||
*
|
||||
* @param parentId
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> listByParentEnable(String parentId, String enable) {
|
||||
if (StringUtils.isEmpty(parentId))
|
||||
parentId = CommonConstant.ROOT;
|
||||
return sysAuthorityRepository.getByParentIdAndEnable(parentId, enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id,是否启用查询权限列表
|
||||
*
|
||||
* @param roleId
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> listByRoleIdEnable(String roleId, String enable) {
|
||||
List<SysAuthority> list = new ArrayList<>();
|
||||
List<SysRoleAuthority> roleAuthorities = sysRoleAuthorityService.listByRoleId(roleId);
|
||||
if (CollectionUtils.isNotEmpty(roleAuthorities))
|
||||
return list;
|
||||
List<String> authorityIds = roleAuthorities.stream().map(SysRoleAuthority::getAuthorityId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(authorityIds))
|
||||
list = sysAuthorityRepository.getByEnableAndIdIn(enable, authorityIds);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询父节点下所有权限的id集合,并将状态设置为禁用(禁用权限时用)
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> queryAllChildren(String parentId) {
|
||||
//获取结果
|
||||
List<SysAuthority> sysAuthoritys = listByParentEnable(parentId, CommonConstant.ISENABLE);
|
||||
//遍历子集
|
||||
List<SysAuthority> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(sysAuthoritys)) {
|
||||
for (SysAuthority sysAuthority : sysAuthoritys) {
|
||||
sysAuthority.setEnable(CommonConstant.ISNOTENABLE);
|
||||
sysAuthority.setModifiedTime(new Date());
|
||||
list.add(sysAuthority);
|
||||
list.addAll(queryAllChildren(sysAuthority.getId()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父节点禁用所有子节点
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
public boolean disableChildrenByParentId(String parentId) {
|
||||
List<SysAuthority> sysAuthorities = queryAllChildren(parentId);
|
||||
if (CollectionUtils.isNotEmpty(sysAuthorities)) {
|
||||
List<SysAuthority> save = sysAuthorityRepository.save(sysAuthorities);
|
||||
return CollectionUtils.isNotEmpty(save);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询所有节点(包括禁用)
|
||||
*
|
||||
* @param parentId
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthVo> queryAllChildren(String parentId, String enable) {
|
||||
List<SysAuthVo> list = new ArrayList<>();
|
||||
List<SysAuthority> authoritys = sysAuthorityRepository.getByParentIdAndEnable(parentId, enable);
|
||||
if (CollectionUtils.isEmpty(authoritys))
|
||||
return list;
|
||||
SysAuthVo vo;
|
||||
for (SysAuthority authority : authoritys) {
|
||||
vo = new SysAuthVo(authority);
|
||||
vo.setChildren(queryAllChildren(vo.getId(), enable));
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否唯一 true唯一
|
||||
*
|
||||
* @param code
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean uniqueCode(String code, String id) {
|
||||
if (StringUtils.isEmpty(code))
|
||||
throw new BusinessException("code不能为空");
|
||||
SysAuthority one = sysAuthorityRepository.getByCode(code);
|
||||
if (one != null) {
|
||||
return StringUtils.isNotEmpty(id) && id.equals(one.getId());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.xwbing.service;
|
||||
|
||||
import com.xwbing.entity.SysRoleAuthority;
|
||||
import com.xwbing.repository.SysRoleAuthorityRepository;
|
||||
import com.xwbing.util.PassWordUtil;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 15:15
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleAuthorityService {
|
||||
@Resource
|
||||
private SysRoleAuthorityRepository sysRoleAuthorityRepository;
|
||||
|
||||
/**
|
||||
* 执行用户角色权限保存操作,保存之前先判断是否存在,存在删除
|
||||
*
|
||||
* @param list
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
public RestMessage saveBatch(List<SysRoleAuthority> list, String roleId) {
|
||||
RestMessage result = new RestMessage();
|
||||
//获取角色原有权限
|
||||
List<SysRoleAuthority> roleAuthorities = listByRoleId(roleId);
|
||||
//删除原有权限
|
||||
if (CollectionUtils.isNotEmpty(roleAuthorities)) {
|
||||
sysRoleAuthorityRepository.deleteInBatch(roleAuthorities);
|
||||
}
|
||||
//角色新增权限
|
||||
list.forEach(roleAuthority -> {
|
||||
roleAuthority.setId(PassWordUtil.createId());
|
||||
roleAuthority.setModifiedTime(new Date());
|
||||
});
|
||||
List<SysRoleAuthority> save = sysRoleAuthorityRepository.save(list);
|
||||
if (CollectionUtils.isNotEmpty(save)) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("保存角色权限成功");
|
||||
} else {
|
||||
result.setMessage("保存角色权限失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据角色主键获取
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
public List<SysRoleAuthority> listByRoleId(String roleId) {
|
||||
return sysRoleAuthorityRepository.getByRoleId(roleId);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.xwbing.service;
|
||||
|
||||
import com.xwbing.entity.SysRole;
|
||||
import com.xwbing.entity.SysUserRole;
|
||||
import com.xwbing.exception.BusinessException;
|
||||
import com.xwbing.repository.SysRoleRepository;
|
||||
import com.xwbing.util.PassWordUtil;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
@@ -24,6 +28,8 @@ import java.util.List;
|
||||
public class SysRoleService {
|
||||
@Resource
|
||||
private SysRoleRepository sysRoleRepository;
|
||||
@Resource
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
private final Logger logger = LoggerFactory.getLogger(SysRoleService.class);
|
||||
|
||||
/**
|
||||
@@ -120,6 +126,24 @@ public class SysRoleService {
|
||||
return sysRoleRepository.getByEnable(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户主键,是否启用状态查询角色列表
|
||||
*
|
||||
* @param userId
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<SysRole> listByUserIdEnable(String userId, String enable) {
|
||||
List<SysRole> list = new ArrayList<>();
|
||||
List<SysUserRole> sysUserRoles = sysUserRoleService.listByUserId(userId);
|
||||
if (sysUserRoles == null)
|
||||
return list;
|
||||
List<String> roleIds = sysUserRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(roleIds))
|
||||
list = sysRoleRepository.getByEnableAndIdIn(enable, roleIds);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查code是否唯一 true唯一
|
||||
*
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.xwbing.service;
|
||||
|
||||
import com.xwbing.entity.SysUserRole;
|
||||
import com.xwbing.repository.SysUserRoleRepository;
|
||||
import com.xwbing.util.PassWordUtil;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 14:15
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
@Service
|
||||
public class SysUserRoleService {
|
||||
@Resource
|
||||
private SysUserRoleRepository sysUserRoleRepository;
|
||||
|
||||
/**
|
||||
* 执行用户角色权限保存操作,保存之前先判断是否存在,存在删除
|
||||
*
|
||||
* @param list
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public RestMessage saveBatch(List<SysUserRole> list, String userId) {
|
||||
RestMessage result = new RestMessage();
|
||||
//获取用户原有角色
|
||||
List<SysUserRole> sysUserRoles = listByUserId(userId);
|
||||
//删除原有角色
|
||||
if (CollectionUtils.isNotEmpty(sysUserRoles)) {
|
||||
sysUserRoleRepository.deleteInBatch(sysUserRoles);
|
||||
}
|
||||
//用户新增角色
|
||||
list.forEach(sysUserRole -> {
|
||||
sysUserRole.setId(PassWordUtil.createId());
|
||||
sysUserRole.setModifiedTime(new Date());
|
||||
});
|
||||
List<SysUserRole> save = sysUserRoleRepository.save(list);
|
||||
if (CollectionUtils.isNotEmpty(save)) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("保存用户角色成功");
|
||||
} else {
|
||||
result.setMessage("保存用户角色失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户主键获取
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<SysUserRole> listByUserId(String userId) {
|
||||
return sysUserRoleRepository.getByUserId(userId);
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ package com.xwbing.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.constant.CommonConstant;
|
||||
import com.xwbing.constant.CommonEnum;
|
||||
import com.xwbing.entity.SysConfig;
|
||||
import com.xwbing.entity.SysUser;
|
||||
import com.xwbing.entity.SysUserLoginInOut;
|
||||
import com.xwbing.entity.*;
|
||||
import com.xwbing.entity.model.EmailModel;
|
||||
import com.xwbing.exception.BusinessException;
|
||||
import com.xwbing.repository.SysUserRepository;
|
||||
@@ -15,6 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -33,6 +32,10 @@ public class SysUserService {
|
||||
private SysConfigService sysConfigService;
|
||||
@Resource
|
||||
private SysUserLoginInOutService loginInOutService;
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
@Resource
|
||||
private SysAuthorityService sysAuthorityService;
|
||||
|
||||
/**
|
||||
* 增
|
||||
@@ -286,6 +289,34 @@ public class SysUserService {
|
||||
return restMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户主键,是否有效,查找所拥有的权限
|
||||
*
|
||||
* @param userId
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> queryAuthority(String userId, String enable) {
|
||||
List<SysAuthority> list = new ArrayList<>();
|
||||
//根据用戶id和是否启用获取获取角色
|
||||
List<SysRole> sysRoles = sysRoleService.listByUserIdEnable(userId, enable);
|
||||
if (CollectionUtils.isEmpty(sysRoles))
|
||||
return list;
|
||||
List<SysAuthority> temp;
|
||||
//遍获取每个角色拥有的权限,并去重
|
||||
for (SysRole sysRole : sysRoles) {
|
||||
temp = sysAuthorityService.listByRoleIdEnable(sysRole.getId(), enable);
|
||||
if (CollectionUtils.isNotEmpty(temp)) {
|
||||
for (SysAuthority auth : temp) {
|
||||
if (list.contains(auth))
|
||||
continue;// 如果存在,那么去除
|
||||
list.add(auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名查找用户
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user