Commit e6ee9bdbdcf3fab213afb1dfefdb8eb3793682a9

Authored by rui.zhang

Merge remote-tracking branch 'origin/master'

Showing 4 changed files

platform-biz-service/src/main/java/com/lyms/platform/permission/model/DepartmentsQuery.java View file @ e6ee9bd
... ... @@ -4,6 +4,7 @@
4 4 import com.lyms.platform.common.dao.BaseQuery;
5 5  
6 6 import java.util.Date;
  7 +import java.util.List;
7 8  
8 9  
9 10 public class DepartmentsQuery extends BaseQuery {
... ... @@ -21,6 +22,15 @@
21 22 private String shortCode;
22 23 private String keyword;
23 24 private String foreignId;
  25 + private List<Integer> orgList;
  26 +
  27 + public List<Integer> getOrgList() {
  28 + return orgList;
  29 + }
  30 +
  31 + public void setOrgList(List<Integer> orgList) {
  32 + this.orgList = orgList;
  33 + }
24 34  
25 35 public String getForeignId() {
26 36 return foreignId;
platform-biz-service/src/main/resources/mainOrm/Departments.xml View file @ e6ee9bd
... ... @@ -135,6 +135,12 @@
135 135 <if test="keyword != null and keyword != ''">
136 136 and name like CONCAT(#{keyword}, '%')
137 137 </if>
  138 + <if test="orgList != null">
  139 + and org_id in
  140 + <foreach collection="orgList" index="index" item="item" open="(" separator="," close=")">
  141 + #{item}
  142 + </foreach>
  143 + </if>
138 144 </where>
139 145 </sql>
140 146  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DepartmentsController.java View file @ e6ee9bd
... ... @@ -181,11 +181,11 @@
181 181 departmentsQuery.setNeed("true");
182 182 departmentsQuery.setSort("id desc");
183 183 departmentsQuery.setYn(YnEnums.YES.getId());
184   - Integer orgId1 = autoMatchFacade.matchOrgId(loginState.getId());
  184 + List<Integer> orgId1 = autoMatchFacade.matchOrgId(loginState.getId());
185 185 if(null!=orgId){
186 186 departmentsQuery.setOrgId(orgId);
187 187 }else{
188   - departmentsQuery.setOrgId(orgId1);
  188 + departmentsQuery.setOrgList(orgId1);
189 189 }
190 190  
191 191 departmentsQuery.setPage(page);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java View file @ e6ee9bd
... ... @@ -4,10 +4,9 @@
4 4 import com.lyms.platform.biz.service.CommunityConfigService;
5 5 import com.lyms.platform.biz.service.PatientsService;
6 6 import com.lyms.platform.common.enums.YnEnums;
7   -import com.lyms.platform.permission.model.Organization;
8   -import com.lyms.platform.permission.model.Users;
9   -import com.lyms.platform.permission.model.UsersQuery;
  7 +import com.lyms.platform.permission.model.*;
10 8 import com.lyms.platform.permission.service.OrganizationService;
  9 +import com.lyms.platform.permission.service.UserOrganizationMapsService;
11 10 import com.lyms.platform.permission.service.UsersService;
12 11 import com.lyms.platform.pojo.CommunityConfig;
13 12 import com.lyms.platform.pojo.Patients;
... ... @@ -16,6 +15,7 @@
16 15 import org.springframework.beans.factory.annotation.Autowired;
17 16 import org.springframework.stereotype.Component;
18 17  
  18 +import java.util.ArrayList;
19 19 import java.util.List;
20 20  
21 21 /**
... ... @@ -31,6 +31,8 @@
31 31 private CommunityConfigService communityConfigService;
32 32 @Autowired
33 33 private PatientsService patientsService;
  34 + @Autowired
  35 + private UserOrganizationMapsService userOrganizationMapsService;
34 36  
35 37 public String match(int userId) {
36 38 UsersQuery usersQuery = new UsersQuery();
37 39  
38 40  
39 41  
40 42  
... ... @@ -43,25 +45,41 @@
43 45 if (list.get(0).getType() == 1) {
44 46 Organization organization = organizationService.getOrganization(list.get(0).getOrgId());
45 47 return organization.getAreaId();
  48 + }else {
  49 +
46 50 }
47 51 }
48 52 return null;
49 53 }
50 54  
51   - public Integer matchOrgId(int userId){
  55 + public List<Integer> matchOrgId(int userId){
52 56 UsersQuery usersQuery = new UsersQuery();
53 57 usersQuery.setId(userId);
54 58  
55 59 usersQuery.setYn(1);
56 60 List<Users> list = usersService.queryUsers(usersQuery);
  61 + List<Integer> data = new ArrayList<>();
57 62 if (CollectionUtils.isNotEmpty(list)) {
58 63 //用户角色
59 64 if (list.get(0).getType() == 1) {
60   - Organization organization = organizationService.getOrganization(list.get(0).getOrgId());
61   - return organization.getId();
  65 + for(Users users:list){
  66 + if(null!=users.getOrgId()){
  67 + data.add(users.getOrgId());
  68 + }
  69 + }
  70 + } else{
  71 + UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery();
  72 + userOrganizationMapsQuery.setUserId(list.get(0).getId());
  73 + userOrganizationMapsQuery.setYn(YnEnums.YES.getId());
  74 + List<UserOrganizationMaps> list1 = userOrganizationMapsService.queryUserOrganizationMaps(userOrganizationMapsQuery);
  75 + if(CollectionUtils.isNotEmpty(list1)){
  76 + for(UserOrganizationMaps userOrganizationMaps:list1){
  77 + data.add(userOrganizationMaps.getOrgId());
  78 + }
  79 + }
62 80 }
63 81 }
64   - return null;
  82 + return data;
65 83 }
66 84  
67 85