Commit 165588acbf78c237e431366b74887cf7988e78ce
1 parent
f5cbc1cf70
Exists in
master
and in
1 other branch
platform permission
fix bug
Showing 2 changed files with 54 additions and 5 deletions
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
View file @
165588a
1 | 1 | package com.lyms.platform.permission.model; |
2 | 2 | |
3 | 3 | import java.util.Date; |
4 | +import java.util.List; | |
4 | 5 | |
5 | 6 | public class Users { |
6 | 7 | private Integer id; |
... | ... | @@ -20,6 +21,38 @@ |
20 | 21 | private Date created; |
21 | 22 | private String remarks; |
22 | 23 | private Date lastLoginTime; |
24 | + | |
25 | + | |
26 | + private List<Roles> roles; | |
27 | + private Departments departmentses; | |
28 | + private Organization organization; | |
29 | + | |
30 | + | |
31 | + public Departments getDepartmentses() { | |
32 | + return departmentses; | |
33 | + } | |
34 | + | |
35 | + public void setDepartmentses(Departments departmentses) { | |
36 | + this.departmentses = departmentses; | |
37 | + } | |
38 | + | |
39 | + public Organization getOrganization() { | |
40 | + return organization; | |
41 | + } | |
42 | + | |
43 | + public void setOrganization(Organization organization) { | |
44 | + this.organization = organization; | |
45 | + } | |
46 | + | |
47 | + public List<Roles> getRoles() { | |
48 | + return roles; | |
49 | + } | |
50 | + | |
51 | + public void setRoles(List<Roles> roles) { | |
52 | + this.roles = roles; | |
53 | + } | |
54 | + | |
55 | + | |
23 | 56 | |
24 | 57 | public Integer getId() { |
25 | 58 | return id; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
165588a
... | ... | @@ -53,10 +53,6 @@ |
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - | |
57 | - | |
58 | - | |
59 | - | |
60 | 56 | /** |
61 | 57 | * 获取列表 |
62 | 58 | */ |
63 | 59 | |
... | ... | @@ -85,10 +81,30 @@ |
85 | 81 | //TODO 这里查询未完成 模糊查询 |
86 | 82 | |
87 | 83 | List<Users> users = usersService.queryUsers(usersQuery); |
84 | + | |
85 | + //设置用户角色信息 | |
86 | + for(Users user : users) { | |
87 | + user.setRoles(this.getUserRoles(user.getId())); | |
88 | + user.setOrganization(organizationService.getOrganization(user.getId())); | |
89 | + user.setDepartmentses(departmentsService.getDepartments(user.getDeptId())); | |
90 | + } | |
91 | + | |
92 | + | |
88 | 93 | ResultUtils.buildSuccessResultAndWrite(response, users); |
89 | 94 | } |
90 | 95 | |
91 | - | |
96 | + //获取用户角色信息 | |
97 | + private List<Roles> getUserRoles(Integer userId) { | |
98 | + UserRoleMapsQuery query = new UserRoleMapsQuery(); | |
99 | + query.setUserId(userId); | |
100 | + query.setYn(YnEnums.YES.getId()); | |
101 | + List<UserRoleMaps> userRoleMapses = userRoleMapsService.queryUserRoleMaps(query); | |
102 | + List<Roles> roles = new ArrayList<>(); | |
103 | + for(UserRoleMaps roleMaps : userRoleMapses) { | |
104 | + roles.add(rolesService.getRoles(roleMaps.getRoleId())); | |
105 | + } | |
106 | + return roles; | |
107 | + } | |
92 | 108 | |
93 | 109 | |
94 | 110 | /** |