File tree Expand file tree Collapse file tree 7 files changed +35
-29
lines changed
continew-admin-common/src/main/java/top/charles7c/continew/admin/common/constant
continew-admin-system/src/main/java/top/charles7c/continew/admin/system Expand file tree Collapse file tree 7 files changed +35
-29
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public interface ContainerConstants extends top.charles7c.continew.starter.exten
30
30
String USER_ROLE_ID_LIST = "UserRoleIdList" ;
31
31
32
32
/**
33
- * 用户角色名称列表
33
+ * 角色部门列表
34
34
*/
35
- String USER_ROLE_NAME_LIST = "UserRoleNameList " ;
35
+ String ROLE_DEPT_ID_LIST = "RoleDeptIdList " ;
36
36
}
Original file line number Diff line number Diff line change 16
16
17
17
package top .charles7c .continew .admin .system .model .resp ;
18
18
19
- import java .io .Serial ;
20
- import java .util .List ;
21
-
22
- import lombok .Data ;
23
-
24
- import io .swagger .v3 .oas .annotations .media .Schema ;
25
-
19
+ import cn .crane4j .annotation .Assemble ;
20
+ import cn .crane4j .annotation .Mapping ;
26
21
import com .alibaba .excel .annotation .ExcelIgnoreUnannotated ;
27
22
import com .alibaba .excel .annotation .ExcelProperty ;
28
-
29
- import top .charles7c .continew .starter .extension .crud .converter .ExcelBaseEnumConverter ;
23
+ import io .swagger .v3 .oas .annotations .media .Schema ;
24
+ import lombok .Data ;
25
+ import top .charles7c .continew .admin .common .constant .ContainerConstants ;
30
26
import top .charles7c .continew .admin .common .enums .DataScopeEnum ;
31
27
import top .charles7c .continew .admin .common .enums .DisEnableStatusEnum ;
32
28
import top .charles7c .continew .starter .extension .crud .base .BaseDetailResp ;
29
+ import top .charles7c .continew .starter .extension .crud .converter .ExcelBaseEnumConverter ;
30
+
31
+ import java .io .Serial ;
32
+ import java .util .List ;
33
33
34
34
/**
35
35
* 角色详情信息
40
40
@ Data
41
41
@ ExcelIgnoreUnannotated
42
42
@ Schema (description = "角色详情信息" )
43
+ @ Assemble (container = ContainerConstants .ROLE_DEPT_ID_LIST , key = "id" , props = @ Mapping (ref = "deptIds" ))
43
44
public class RoleDetailResp extends BaseDetailResp {
44
45
45
46
@ Serial
Original file line number Diff line number Diff line change 16
16
17
17
package top .charles7c .continew .admin .system .model .resp ;
18
18
19
+ import cn .crane4j .annotation .Assemble ;
19
20
import cn .crane4j .annotation .AssembleMethod ;
20
21
import cn .crane4j .annotation .ContainerMethod ;
21
22
import cn .crane4j .annotation .Mapping ;
22
23
import com .alibaba .excel .annotation .ExcelIgnoreUnannotated ;
23
24
import com .alibaba .excel .annotation .ExcelProperty ;
24
25
import io .swagger .v3 .oas .annotations .media .Schema ;
25
26
import lombok .Data ;
27
+ import top .charles7c .continew .admin .common .constant .ContainerConstants ;
26
28
import top .charles7c .continew .admin .common .enums .DisEnableStatusEnum ;
27
29
import top .charles7c .continew .admin .common .enums .GenderEnum ;
28
30
import top .charles7c .continew .admin .common .util .helper .LoginHelper ;
44
46
@ Data
45
47
@ ExcelIgnoreUnannotated
46
48
@ Schema (description = "用户详情信息" )
49
+ @ Assemble (container = ContainerConstants .USER_ROLE_ID_LIST , key = "id" , props = @ Mapping (ref = "roleIds" ))
47
50
public class UserDetailResp extends BaseDetailResp {
48
51
49
52
@ Serial
Original file line number Diff line number Diff line change 16
16
17
17
package top .charles7c .continew .admin .system .service .impl ;
18
18
19
- import java . util . List ;
20
- import java . util . stream . Collectors ;
21
-
19
+ import cn . crane4j . annotation . ContainerMethod ;
20
+ import cn . crane4j . annotation . MappingType ;
21
+ import cn . hutool . core . collection . CollUtil ;
22
22
import lombok .RequiredArgsConstructor ;
23
-
24
23
import org .springframework .stereotype .Service ;
25
24
import org .springframework .transaction .annotation .Transactional ;
26
-
27
- import cn .hutool .core .collection .CollUtil ;
28
-
25
+ import top .charles7c .continew .admin .common .constant .ContainerConstants ;
29
26
import top .charles7c .continew .admin .system .mapper .RoleDeptMapper ;
30
27
import top .charles7c .continew .admin .system .model .entity .RoleDeptDO ;
31
28
import top .charles7c .continew .admin .system .service .RoleDeptService ;
32
29
30
+ import java .util .List ;
31
+ import java .util .stream .Collectors ;
32
+
33
33
/**
34
34
* 角色和部门业务实现
35
35
*
@@ -78,6 +78,7 @@ public void deleteByDeptIds(List<Long> deptIds) {
78
78
}
79
79
80
80
@ Override
81
+ @ ContainerMethod (namespace = ContainerConstants .ROLE_DEPT_ID_LIST , type = MappingType .NONE )
81
82
public List <Long > listDeptIdByRoleId (Long roleId ) {
82
83
return roleDeptMapper .selectDeptIdByRoleId (roleId );
83
84
}
Original file line number Diff line number Diff line change @@ -138,7 +138,6 @@ protected void fill(Object obj) {
138
138
} else {
139
139
detail .setMenuIds (roleMenuService .listMenuIdByRoleIds (CollUtil .newArrayList (roleId )));
140
140
}
141
- detail .setDeptIds (roleDeptService .listDeptIdByRoleId (roleId ));
142
141
}
143
142
}
144
143
Original file line number Diff line number Diff line change 16
16
17
17
package top .charles7c .continew .admin .system .service .impl ;
18
18
19
- import java . util . List ;
20
- import java . util . stream . Collectors ;
21
-
19
+ import cn . crane4j . annotation . ContainerMethod ;
20
+ import cn . crane4j . annotation . MappingType ;
21
+ import cn . hutool . core . collection . CollUtil ;
22
22
import lombok .RequiredArgsConstructor ;
23
-
24
23
import org .springframework .stereotype .Service ;
25
24
import org .springframework .transaction .annotation .Transactional ;
26
-
27
- import cn .hutool .core .collection .CollUtil ;
28
-
25
+ import top .charles7c .continew .admin .common .constant .ContainerConstants ;
29
26
import top .charles7c .continew .admin .system .mapper .UserRoleMapper ;
30
27
import top .charles7c .continew .admin .system .model .entity .UserRoleDO ;
31
28
import top .charles7c .continew .admin .system .service .UserRoleService ;
32
29
30
+ import java .util .List ;
31
+ import java .util .stream .Collectors ;
32
+
33
33
/**
34
34
* 用户和角色业务实现
35
35
*
@@ -72,6 +72,7 @@ public void deleteByUserIds(List<Long> userIds) {
72
72
}
73
73
74
74
@ Override
75
+ @ ContainerMethod (namespace = ContainerConstants .USER_ROLE_ID_LIST , type = MappingType .NONE )
75
76
public List <Long > listRoleIdByUserId (Long userId ) {
76
77
return userRoleMapper .selectRoleIdByUserId (userId );
77
78
}
Original file line number Diff line number Diff line change @@ -152,9 +152,10 @@ public void delete(List<Long> ids) {
152
152
protected void fill (Object obj ) {
153
153
super .fill (obj );
154
154
if (obj instanceof UserDetailResp detail ) {
155
- List <Long > roleIdList = userRoleService .listRoleIdByUserId (detail .getId ());
156
- detail .setRoleIds (roleIdList );
157
- detail .setRoleNames (String .join (StringConstants .CHINESE_COMMA , roleService .listNameByIds (roleIdList )));
155
+ List <Long > roleIdList = detail .getRoleIds ();
156
+ if (CollUtil .isNotEmpty (roleIdList )) {
157
+ detail .setRoleNames (String .join (StringConstants .CHINESE_COMMA , roleService .listNameByIds (roleIdList )));
158
+ }
158
159
}
159
160
}
160
161
You can’t perform that action at this time.
0 commit comments