src/main/java/org/springblade/modules/community/mapper/CommunityMapper.java
@@ -40,5 +40,10 @@ */ List<CommunityVO> selectCommunityPage(IPage page,@Param("community") CommunityVO community); /** * 查询个人社区编号集合 * @param userId * @return */ List<String> getCommunityCodeListByUserId(@Param("userId") Long userId); } src/main/java/org/springblade/modules/community/mapper/CommunityMapper.xml
@@ -36,5 +36,11 @@ </if> </select> <!--自定义分页列表查询--> <select id="getCommunityCodeListByUserId" resultType="java.lang.String"> select code from jczz_community where is_deleted = 0 and res_police_user_id = #{userId} </select> </mapper> src/main/java/org/springblade/modules/community/service/ICommunityService.java
@@ -21,6 +21,8 @@ import org.springblade.modules.community.vo.CommunityVO; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 社区表 服务类 * @@ -39,4 +41,10 @@ IPage<CommunityVO> selectCommunityPage(IPage<CommunityVO> page, CommunityVO community); /** * 查询个人社区编号集合 * @param userId * @return */ List<String> getCommunityCodeListByUserId(Long userId); } src/main/java/org/springblade/modules/community/service/impl/CommunityServiceImpl.java
@@ -24,6 +24,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * 社区表 服务实现类 * @@ -38,5 +40,13 @@ return page.setRecords(baseMapper.selectCommunityPage(page, community)); } /** * 查询个人社区编号集合 * @param userId * @return */ @Override public List<String> getCommunityCodeListByUserId(Long userId) { return baseMapper.getCommunityCodeListByUserId(userId); } } src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.java
@@ -55,14 +55,16 @@ * @return */ List<TreeStringNode> getRegionListByGroupTwon(@Param("houseParam") HouseParam houseParam, @Param("list") List<String> list); @Param("list") List<String> list, @Param("communityList") List<String> communityList); /** * 查询社区数据 * @return */ List<TreeStringNode> getRegionListByGroupNei(@Param("houseParam") HouseParam houseParam, @Param("list") List<String> list); @Param("list") List<String> list, @Param("communityList") List<String> communityList); /** * 根据社区名称查询小区集合 @@ -71,7 +73,8 @@ * @return */ List<TreeStringNode> getDistrictList(@Param("houseParam") HouseParam houseParam, @Param("list") List<String> list); @Param("list") List<String> list, @Param("communityList") List<String> communityList); /** * 根据社区名称查询楼栋集合 src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -21,6 +21,25 @@ </if> </sql> <!--过滤社区数据--> <sql id="filterCommunity"> <if test="houseParam.roleName!=null and houseParam.roleName!=''"> <if test="houseParam.roleName=='民警' and houseParam.userId!='1726859808689696770'"> <choose> <when test="communityList != null and communityList.size()>0"> and nei_code in <foreach collection="communityList" item="neiCode" separator ="," open="(" close=")"> #{neiCode} </foreach> </when> <otherwise> and nei_code in ('') </otherwise> </choose> </if> </if> </sql> <!--门牌地址详情查询--> <resultMap id="doorplateAddressDetailMap" type="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO" autoMapping="true"> @@ -56,6 +75,7 @@ and nei_name = '万达社区居民委员会' </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by town_street_code,town_street_name </select> @@ -67,6 +87,7 @@ and nei_name = '万达社区居民委员会' </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by nei_code,nei_name,town_street_code </select> @@ -83,6 +104,7 @@ and nei_code = #{houseParam.code} </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by aoi_code,aoi_name union all ( @@ -97,6 +119,7 @@ and nei_code = #{houseParam.code} </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by aoi_code,sub_aoi ) union all @@ -111,6 +134,7 @@ and nei_code = #{houseParam.code} </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by nei_code ) union all src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java
@@ -118,21 +118,26 @@ String userId = AuthUtil.getUserId().toString(); houseParam.setUserId(userId); List<String> stringList = new ArrayList<>(); List<String> communityList = new ArrayList<>(); if (null!=roleName && !roleName.equals("")){ houseParam.setRoleName(roleName); if (roleName.equals("网格员") && !userId.equals("1726859808689696770")){ // 查询对应的房屋地址code stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); } if (roleName.equals("民警")){ // 查询对应的社区编号 communityList = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); } } List<TreeStringNode> list = new ArrayList<>(); if (null!=type) { // 如果是网格管理员,系统管理员 // 如果是网格管理员,系统管理员,民警 if (type==1){ // 查询街道 List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam,stringList); List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam,stringList,communityList); // 查询社区 List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam,stringList); List<TreeStringNode> neiList = baseMapper.getRegionListByGroupNei(houseParam,stringList,communityList); // 遍历 for (TreeStringNode treeNode : townList) { // 遍历 @@ -228,12 +233,13 @@ Map<String, Object> map = new HashMap<>(2); // 获取网格员对应的地址编号集合 List<String> stringList = getHouseCodeList(houseParam); List<String> communityCodeList = getCommunityCodeList(houseParam); // 获取网格员对应的网格信息 getGridInfoByGridman(houseParam); // 查小区,场所 if (houseParam.getType()==1){ // 根据社区名称查询小区集合 list = baseMapper.getDistrictList(houseParam,stringList); list = baseMapper.getDistrictList(houseParam,stringList,communityCodeList); } // 查楼栋,街路巷 if (houseParam.getType()==2){ @@ -626,6 +632,24 @@ } /** * 根据角色获取社区编号集合 * @param houseParam * @return */ private List<String> getCommunityCodeList(HouseParam houseParam) { List<String> stringList = new ArrayList<>(); String userId = AuthUtil.getUserId().toString(); houseParam.setUserId(userId); if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) { if (houseParam.getRoleName().equals("民警") && !userId.equals("1726859808689696770")) { // 查询对应的房屋地址code stringList = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); } } return stringList; } /** * 房屋数据处理 * @return */