mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-21 18:57:12 +08:00
fix:修复新建租户的管理员用户角色回显错误
This commit is contained in:
@@ -180,4 +180,4 @@
|
||||
<artifactId>continew-starter-extension-tenant-mp</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.continew.admin.system.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alicp.jetcache.anno.CacheInvalidate;
|
||||
@@ -50,6 +51,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 角色业务实现
|
||||
@@ -135,7 +137,13 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
|
||||
|
||||
@Override
|
||||
public List<LabelValueResp> dict(RoleQuery query, SortQuery sortQuery) {
|
||||
query.setExcludeRoleCodes(RoleCodeEnum.getSuperRoleCodes());
|
||||
List<String> currentUserRoleCodes = StpUtil.getRoleList();
|
||||
final List<String> superRoleCodes = RoleCodeEnum.getSuperRoleCodes();
|
||||
// dict查询的时候,需要查询当前用户拥有的角色而不是排除,避免前端显示角色数字而不是角色名称
|
||||
final List<String> excludeRoleCodes = superRoleCodes.stream()
|
||||
.filter(roleCode -> !currentUserRoleCodes.contains(roleCode))
|
||||
.collect(Collectors.toList());
|
||||
query.setExcludeRoleCodes(CollUtil.defaultIfEmpty(excludeRoleCodes, superRoleCodes));
|
||||
return super.dict(query, sortQuery);
|
||||
}
|
||||
|
||||
|
6
pom.xml
6
pom.xml
@@ -114,6 +114,12 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<compilerArgument>-parameters</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
Reference in New Issue
Block a user