mirror of https://gitee.com/stylefeng/roses
【7.1.1】查询资源用set不用list
parent
41e5bc3cfb
commit
bf60703048
|
@ -27,7 +27,6 @@ package cn.stylefeng.roses.kernel.system.api;
|
|||
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ResourceDefinition;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ResourceUrlParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -56,6 +55,6 @@ public interface ResourceServiceApi {
|
|||
* @author fengshuonan
|
||||
* @date 2020/11/29 19:49
|
||||
*/
|
||||
Set<String> getResourceUrlsListByCodes(List<String> resourceCodes);
|
||||
Set<String> getResourceUrlsListByCodes(Set<String> resourceCodes);
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public interface RoleServiceApi {
|
|||
* @author majianguo
|
||||
* @date 2020/11/5 上午11:17
|
||||
*/
|
||||
List<String> getRoleResourceCodeList(List<Long> roleIdList);
|
||||
Set<String> getRoleResourceCodeList(List<Long> roleIdList);
|
||||
|
||||
/**
|
||||
* 获取角色的资源code集合
|
||||
|
|
|
@ -140,7 +140,7 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
|||
if (!loginUserApi.getSuperAdminFlag()) {
|
||||
// 获取权限列表
|
||||
List<Long> roleIds = loginUserApi.getLoginUser().getSimpleRoleInfoList().parallelStream().map(SimpleRoleInfo::getRoleId).collect(Collectors.toList());
|
||||
List<String> resourceCodeList = roleServiceApi.getRoleResourceCodeList(roleIds);
|
||||
Set<String> resourceCodeList = roleServiceApi.getRoleResourceCodeList(roleIds);
|
||||
if (!resourceCodeList.isEmpty()) {
|
||||
sysResourceLambdaQueryWrapper.in(SysResource::getResourceCode, resourceCodeList);
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getResourceUrlsListByCodes(List<String> resourceCodes) {
|
||||
public Set<String> getResourceUrlsListByCodes(Set<String> resourceCodes) {
|
||||
|
||||
if (resourceCodes == null || resourceCodes.isEmpty()) {
|
||||
return new HashSet<>();
|
||||
|
|
|
@ -481,9 +481,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRoleResourceCodeList(List<Long> roleIdList) {
|
||||
public Set<String> getRoleResourceCodeList(List<Long> roleIdList) {
|
||||
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
HashSet<String> result = new HashSet<>();
|
||||
|
||||
for (Long roleId : roleIdList) {
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
SysUserOrgDTO userOrgInfo = sysUserOrgService.getUserOrgByUserId(userId);
|
||||
|
||||
// 5. 获取用户的所有资源url
|
||||
List<String> resourceCodeList = roleServiceApi.getRoleResourceCodeList(roleIds);
|
||||
Set<String> resourceCodeList = roleServiceApi.getRoleResourceCodeList(roleIds);
|
||||
Set<String> resourceUrlsListByCodes = resourceServiceApi.getResourceUrlsListByCodes(resourceCodeList);
|
||||
|
||||
// 6. 获取用户的所有按钮code集合
|
||||
|
|
Loading…
Reference in New Issue