From fa77fc50eea4ae31722f16c583ec8f9a51ad632d Mon Sep 17 00:00:00 2001
From: tao <275944430@qq.com>
Date: Wed, 10 Sep 2025 12:23:47 +0000
Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=96=B0?=
=?UTF-8?q?=E5=BB=BA=E7=A7=9F=E6=88=B7=E7=9A=84=E7=AE=A1=E7=90=86=E5=91=98?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2=E5=9B=9E=E6=98=BE=E9=94=99?=
=?UTF-8?q?=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
continew-common/pom.xml | 2 +-
.../admin/system/service/impl/RoleServiceImpl.java | 10 +++++++++-
pom.xml | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/continew-common/pom.xml b/continew-common/pom.xml
index 374387a3..46e495e7 100644
--- a/continew-common/pom.xml
+++ b/continew-common/pom.xml
@@ -180,4 +180,4 @@
continew-starter-extension-tenant-mp
-
\ No newline at end of file
+
diff --git a/continew-system/src/main/java/top/continew/admin/system/service/impl/RoleServiceImpl.java b/continew-system/src/main/java/top/continew/admin/system/service/impl/RoleServiceImpl.java
index 6a70cf5e..8a6a0941 100644
--- a/continew-system/src/main/java/top/continew/admin/system/service/impl/RoleServiceImpl.java
+++ b/continew-system/src/main/java/top/continew/admin/system/service/impl/RoleServiceImpl.java
@@ -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 dict(RoleQuery query, SortQuery sortQuery) {
- query.setExcludeRoleCodes(RoleCodeEnum.getSuperRoleCodes());
+ List currentUserRoleCodes = StpUtil.getRoleList();
+ final List superRoleCodes = RoleCodeEnum.getSuperRoleCodes();
+ // dict查询的时候,需要查询当前用户拥有的角色而不是排除,避免前端显示角色数字而不是角色名称
+ final List excludeRoleCodes = superRoleCodes.stream()
+ .filter(roleCode -> !currentUserRoleCodes.contains(roleCode))
+ .collect(Collectors.toList());
+ query.setExcludeRoleCodes(CollUtil.defaultIfEmpty(excludeRoleCodes, superRoleCodes));
return super.dict(query, sortQuery);
}
diff --git a/pom.xml b/pom.xml
index 6ebe0813..ebc8c684 100644
--- a/pom.xml
+++ b/pom.xml
@@ -114,6 +114,12 @@
org.apache.maven.plugins
maven-compiler-plugin
+
+
+ org.projectlombok
+ lombok
+
+
-parameters