Commit c0a5eafb542f846b86761ac9190c861d39495e13

Authored by jiangjiazhi
1 parent e5ce5d7824

增加

Showing 5 changed files with 28 additions and 6 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/model/DepartmentsQuery.java View file @ c0a5eaf
... ... @@ -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/java/com/lyms/platform/permission/model/UsersQuery.java View file @ c0a5eaf
... ... @@ -29,7 +29,7 @@
29 29 private String keyword;
30 30 private Integer roleId;
31 31 private String foreignId;
32   - private Integer otherAccount; //µÚÈý·½ÕʺÅ, 1Ò½ÔºÕʺÅ
  32 + private Integer otherAccount;
33 33  
34 34 public Integer getOtherAccount() {
35 35 return otherAccount;
platform-biz-service/src/main/resources/mainOrm/Departments.xml View file @ c0a5eaf
... ... @@ -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 @ c0a5eaf
... ... @@ -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 @ c0a5eaf
... ... @@ -16,6 +16,7 @@
16 16 import org.springframework.beans.factory.annotation.Autowired;
17 17 import org.springframework.stereotype.Component;
18 18  
  19 +import java.util.ArrayList;
19 20 import java.util.List;
20 21  
21 22 /**
22 23  
23 24  
... ... @@ -48,17 +49,22 @@
48 49 return null;
49 50 }
50 51  
51   - public Integer matchOrgId(int userId){
  52 + public List<Integer> matchOrgId(int userId){
52 53 UsersQuery usersQuery = new UsersQuery();
53 54 usersQuery.setId(userId);
54 55  
55 56 usersQuery.setYn(1);
56 57 List<Users> list = usersService.queryUsers(usersQuery);
  58 + List<Integer> data = new ArrayList<>();
57 59 if (CollectionUtils.isNotEmpty(list)) {
58 60 //用户角色
59 61 if (list.get(0).getType() == 1) {
60   - Organization organization = organizationService.getOrganization(list.get(0).getOrgId());
61   - return organization.getId();
  62 + for(Users users:list){
  63 + if(null!=users.getOrgId()){
  64 + data.add(users.getOrgId());
  65 + }
  66 + }
  67 + return data;
62 68 }
63 69 }
64 70 return null;