Commit d12288a3c0f38e99f2c3e820d2a1a90c2aca88a8

Authored by jiangjiazhi
1 parent de0253a007

修改机构按照权限查询

Showing 3 changed files with 34 additions and 9 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/model/OrganizationQuery.java View file @ d12288a
... ... @@ -27,9 +27,17 @@
27 27 private String shortCode;
28 28 private String keyword;
29 29 private String foreignId;
30   -
  30 + private List<String> provinceIds;
31 31 private List<Integer> typeList;
32 32 private List<Integer> idList;
  33 +
  34 + public List<String> getProvinceIds() {
  35 + return provinceIds;
  36 + }
  37 +
  38 + public void setProvinceIds(List<String> provinceIds) {
  39 + this.provinceIds = provinceIds;
  40 + }
33 41  
34 42 public List<Integer> getIdList() {
35 43 return idList;
platform-biz-service/src/main/resources/mainOrm/Organization.xml View file @ d12288a
... ... @@ -183,6 +183,12 @@
183 183 #{item}
184 184 </foreach>
185 185 </if>
  186 + <if test="provinceIds != null and provinceIds.size() > 0">
  187 + and province_id in
  188 + <foreach collection="provinceIds" index="index" item="item" open="(" separator="," close=")">
  189 + #{item}
  190 + </foreach>
  191 + </if>
186 192 </where>
187 193 </sql>
188 194  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java View file @ d12288a
... ... @@ -223,7 +223,7 @@
223 223 list.add(4);
224 224 organizationQuery.setYn(YnEnums.YES.getId());
225 225 // organizationQuery.setTypeList(list);
226   - organizations = organizationService.queryOrganization(organizationQuery);
  226 + organizations = organizationService.queryOrganization(organizationQuery);
227 227  
228 228 } else {
229 229 UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery();
... ... @@ -250,13 +250,13 @@
250 250 @RequestMapping(value = "/organization", method = RequestMethod.GET)
251 251 @ResponseBody
252 252 @TokenRequired
253   - public FrontEndResult getOrganization(
254   - @RequestParam(value = "id", required = false) Integer id,
255   - @RequestParam(value = "keyword", required = false) String keyword,
256   - @RequestParam(value = "page", required = false) Integer page,
257   - @RequestParam(value = "limit", required = false) Integer limit,
258   - @RequestParam(value = "areaId", required = false) String areaId,
259   - @RequestParam(value = "lite", required = false) String f) {
  253 + public FrontEndResult getOrganization(HttpServletRequest request,
  254 + @RequestParam(value = "id", required = false) Integer id,
  255 + @RequestParam(value = "keyword", required = false) String keyword,
  256 + @RequestParam(value = "page", required = false) Integer page,
  257 + @RequestParam(value = "limit", required = false) Integer limit,
  258 + @RequestParam(value = "areaId", required = false) String areaId,
  259 + @RequestParam(value = "lite", required = false) String f) {
260 260  
261 261 limit = limit == null ? 10 : limit;
262 262 page = page == null ? 1 : page;
... ... @@ -293,6 +293,17 @@
293 293 }
294 294 }
295 295 }
  296 + } else if ("0".equals(areaId)) {
  297 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  298 + List<Integer> list = autoMatchFacade.matchOrgId(loginState.getId());
  299 + List<String> a = new ArrayList<>();
  300 + for (Integer integer : list) {
  301 + Organization organization = organizationService.getOrganization(integer);
  302 + if (null != organization) {
  303 + a.add(organization.getProvinceId());
  304 + }
  305 + }
  306 + organizationQuery.setProvinceIds(a);
296 307 }
297 308  
298 309 List<Organization> organizations = organizationService.queryOrganization(organizationQuery);