From 7d0310cafba32916c055ac0d04fef6b6c02c6eb7 Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期二, 11 十月 2022 11:27:33 +0800
Subject: [PATCH] update
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java | 40 +++++++++++++++++++++++++++++++++++-----
1 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
index 6c1f5b2..b7e0346 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComAreaTownCommunityApi.java
@@ -1,17 +1,21 @@
package com.panzhihua.service_community.api;
+import cn.hutool.core.util.ArrayUtil;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.dtos.property.CommonPage;
import com.panzhihua.service_community.dao.ComAreaTownCommunityDao;
import com.panzhihua.common.model.vos.community.acid.ComAreaCounty;
import com.panzhihua.service_community.entity.ComAreaTownCommunity;
import com.panzhihua.service_community.service.ComAreaTownCommunityService;
+import org.apache.commons.lang3.ArrayUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -89,13 +93,26 @@
}
@GetMapping("/areaTownCommunity")
- public R test(@RequestParam("name")String name){
+ public R test(@RequestParam("name")String name,@RequestParam("userId")Long userId){
+ Long[] idArray={4L,17959L,16522L,16196L,16214L,17949L,89234L};
if("panzhihua".equals(name)){
List<ComAreaCounty> list=comAreaTownCommunityDao.selectArea();
list.forEach(lis->{
List<ComAreaCounty> townList=comAreaTownCommunityDao.selectTown(lis.getValue());
townList.forEach(tow->{
- tow.setChildren(comAreaTownCommunityDao.selectCommunity(tow.getValue()));
+ List<ComAreaCounty> list1=new ArrayList<>();
+ if(ArrayUtil.contains(idArray,userId)){
+ list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"学园社区");
+ }
+ else {
+ list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"");
+ }
+ if("大渡口街道".equals(tow.getValue())){
+ ComAreaCounty comAreaCounty=list1.get(0);
+ list1.remove(0);
+ list1.add(2,comAreaCounty);
+ }
+ tow.setChildren(list1);
});
lis.setChildren(townList);
});
@@ -105,13 +122,26 @@
List<ComAreaCounty> townList=comAreaTownCommunityDao.selectTown(name);
if(!CollectionUtils.isEmpty(townList)){
townList.forEach(tow->{
- tow.setChildren(comAreaTownCommunityDao.selectCommunity(tow.getValue()));
+ List<ComAreaCounty> list1=new ArrayList<>();
+ if(ArrayUtil.contains(idArray,userId)){
+ list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"学园社区");
+ }
+ else {
+ list1=comAreaTownCommunityDao.selectCommunity(tow.getValue(),"");
+ }
+ tow.setChildren(list1);
});
return R.ok(townList);
}
else {
- List<ComAreaCounty> list=comAreaTownCommunityDao.selectCommunity(name);
- return R.ok(list);
+ List<ComAreaCounty> list1=new ArrayList<>();
+ if(ArrayUtil.contains(idArray,userId)){
+ list1=comAreaTownCommunityDao.selectCommunity(name,"学园社区");
+ }
+ else {
+ list1=comAreaTownCommunityDao.selectCommunity(name,"");
+ }
+ return R.ok(list1);
}
}
--
Gitblit v1.7.1