From 8652e69d17ab0c1a5884c662a9f3f950ddf57948 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 15 七月 2025 16:16:11 +0800
Subject: [PATCH] 优化 和修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java
index de5d127..ccd8a57 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_westcommittee/src/main/java/com/panzhihua/westcommittee/api/DepartmentController.java
@@ -108,6 +108,15 @@
                 return  R.ok(new ArrayList<>());
             }
             level=loginUserInfoWest.getAccountLevel();
+			if(level==2){
+				code="510403";
+			}
+			if(level==3){
+				code = loginUserInfoWest.getStreetId();
+			}
+			if(level==4){
+				code = loginUserInfoWest.getCommunityId().toString();
+			}
             type=2;
         }
 			List<Department> list4=new ArrayList<>();
@@ -116,15 +125,15 @@
 			}else if(level==2 && type==2){
 				 list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).ge( Department::getTier, 2));
 			}else  if(level==3 && type==1){
-				list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq( Department::getTier, 3).eq(Department::getStreetId, loginUserInfoWest.getStreetId()));
+				list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq( Department::getTier, 3).eq(Department::getStreetId, code));
 			}else if(level==3 && type==2){
-                List<Long> ids = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getStreetId, loginUserInfoWest.getStreetId())).stream().map(ComAct::getCommunityId).collect(Collectors.toList());
-                list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq( Department::getTier, 3).eq(Department::getStreetId, loginUserInfoWest.getStreetId())
+                List<Long> ids = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getStreetId, code)).stream().map(ComAct::getCommunityId).collect(Collectors.toList());
+                list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq( Department::getTier, 3).eq(Department::getStreetId, code)
                         .or(w->w.eq(Department::getTier,4).in(Department::getCommunityId,ids)));
 			}else  if(level==4 && type==1){
-				list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq( Department::getTier, 4).eq(Department::getCommunityId,loginUserInfoWest.getCommunityId()));
+				list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq( Department::getTier, 4).eq(Department::getCommunityId,code));
 			}else if(level==4 && type==2){
-				list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 4).eq(Department::getCommunityId,loginUserInfoWest.getCommunityId()));
+				list4 = departmentService.list(new LambdaQueryWrapper<Department>().like(StringUtils.isNotEmpty(name), Department::getName, name).eq(Department::getTier, 4).eq(Department::getCommunityId,code));
 			}
 			return R.ok(list4);
 

--
Gitblit v1.7.1