File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
continew-system/src/main/java/top/continew/admin/system/service/impl Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 180180 <artifactId >continew-starter-extension-tenant-mp</artifactId >
181181 </dependency >
182182 </dependencies >
183- </project >
183+ </project >
Original file line number Diff line number Diff line change 1616
1717package top .continew .admin .system .service .impl ;
1818
19+ import cn .dev33 .satoken .stp .StpUtil ;
1920import cn .hutool .core .collection .CollUtil ;
2021import cn .hutool .core .util .ObjectUtil ;
2122import com .alicp .jetcache .anno .CacheInvalidate ;
5051import java .util .List ;
5152import java .util .Optional ;
5253import java .util .Set ;
54+ import java .util .stream .Collectors ;
5355
5456/**
5557 * 角色业务实现
@@ -135,7 +137,13 @@ public void fill(Object obj) {
135137
136138 @ Override
137139 public List <LabelValueResp > dict (RoleQuery query , SortQuery sortQuery ) {
138- query .setExcludeRoleCodes (RoleCodeEnum .getSuperRoleCodes ());
140+ List <String > currentUserRoleCodes = StpUtil .getRoleList ();
141+ final List <String > superRoleCodes = RoleCodeEnum .getSuperRoleCodes ();
142+ // dict查询的时候,需要查询当前用户拥有的角色而不是排除,避免前端显示角色数字而不是角色名称
143+ final List <String > excludeRoleCodes = superRoleCodes .stream ()
144+ .filter (roleCode -> !currentUserRoleCodes .contains (roleCode ))
145+ .collect (Collectors .toList ());
146+ query .setExcludeRoleCodes (CollUtil .defaultIfEmpty (excludeRoleCodes , superRoleCodes ));
139147 return super .dict (query , sortQuery );
140148 }
141149
Original file line number Diff line number Diff line change 114114 <groupId >org.apache.maven.plugins</groupId >
115115 <artifactId >maven-compiler-plugin</artifactId >
116116 <configuration >
117+ <annotationProcessorPaths >
118+ <path >
119+ <groupId >org.projectlombok</groupId >
120+ <artifactId >lombok</artifactId >
121+ </path >
122+ </annotationProcessorPaths >
117123 <compilerArgument >-parameters</compilerArgument >
118124 </configuration >
119125 </plugin >
You can’t perform that action at this time.
0 commit comments