src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -21,6 +21,8 @@ </if> </sql> <!--过滤社区数据--> <sql id="filterCommunity"> <if test="houseParam.roleName!=null and houseParam.roleName!=''"> @@ -39,6 +41,7 @@ </if> </if> </sql> <!--门牌地址详情查询--> <resultMap id="doorplateAddressDetailMap" type="org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO" @@ -68,27 +71,95 @@ <!--查询区域数据-街道--> <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeStringNode" > select town_street_code as id,town_street_name as name from jczz_doorplate_address where 1=1 <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'"> and nei_name = '万达社区居民委员会' <!-- <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeStringNode" >--> <!-- select town_street_code as id,town_street_name as name from jczz_doorplate_address--> <!-- where 1=1--> <!-- <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'">--> <!-- and nei_name = '万达社区居民委员会'--> <!-- </if>--> <!-- <include refid="filterHouseGrid"/>--> <!-- <include refid="filterCommunity"/>--> <!-- group by town_street_code,town_street_name--> <!-- </select>--> <!--过滤网格数据--> <sql id="filterHouseGridByTownOrCommunity"> <if test="houseParam.roleName!=null and houseParam.roleName!='' and houseParam.roleName!='系统管理员'"> <choose> <when test="houseParam.roleName=='网格员' and houseParam.userId!='1726859808689696770'"> <choose> <when test="list != null and list.size()>0"> and jg.grid_code in <foreach collection="list" item="gridCode" separator ="," open="(" close=")"> #{gridCode} </foreach> </when> <otherwise> and jg.grid_code in ('') </otherwise> </choose> </when> <otherwise> and jg.grid_code in ('') </otherwise> </choose> </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by town_street_code,town_street_name </sql> <!--查询区域数据-街道--> <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeStringNode" > select br.town_code as id,br.town_name as name from jczz_grid jg left join blade_region br on jg.community_code = br.code where jg.is_deleted = 0 <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'"> and br.name = '万达社区居民委员会' </if> <include refid="filterHouseGridByTownOrCommunity"/> union select br.town_code as id,br.town_name as name from jczz_police_affairs_grid jpag left join blade_region br on jpag.community_code = br.code where jpag.is_deleted = 0 <include refid="filterCommunityByTownOrCommunity"/> </select> <!--过滤社区数据--> <sql id="filterCommunityByTownOrCommunity"> <if test="houseParam.roleName!=null and houseParam.roleName!=''"> <choose> <when test="houseParam.roleName=='民警' and houseParam.userId!='1726859808689696770'"> <choose> <when test="communityList != null and communityList.size()>0"> and br.code in <foreach collection="communityList" item="code" separator ="," open="(" close=")"> #{code} </foreach> </when> <otherwise> and br.code in ('') </otherwise> </choose> </when> <otherwise> and br.code in ('') </otherwise> </choose> </if> </sql> <!--查询区域数据-社区--> <select id="getRegionListByGroupNei" resultType="org.springblade.common.node.TreeStringNode" > select nei_code as id,nei_name as name,town_street_code as parentId from jczz_doorplate_address where 1=1 select br.village_code as id,br.village_name as name,br.town_code as parentId from jczz_grid jg left join blade_region br on jg.community_code = br.code where jg.is_deleted = 0 <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'"> and nei_name = '万达社区居民委员会' </if> <include refid="filterHouseGrid"/> <include refid="filterCommunity"/> group by nei_code,nei_name,town_street_code <include refid="filterHouseGridByTownOrCommunity"/> union select br.village_code as id,br.village_name as name,br.town_code as parentId from jczz_police_affairs_grid jpag left join blade_region br on jpag.community_code = br.code where jpag.is_deleted = 0 <include refid="filterCommunityByTownOrCommunity"/> </select> <!--根据社区名称查询小区集合--> src/main/java/org/springblade/modules/doorplateAddress/service/impl/DoorplateAddressServiceImpl.java
@@ -54,6 +54,7 @@ import org.springblade.modules.place.service.IPlaceExtService; import org.springblade.modules.place.service.IPlaceService; import org.springblade.modules.place.vo.PlaceVO; import org.springblade.modules.police.service.IPoliceAffairsGridService; import org.springblade.modules.system.entity.Region; import org.springblade.modules.system.service.IRegionService; import org.springframework.beans.factory.annotation.Autowired; @@ -105,6 +106,9 @@ @Autowired private ICommunityService communityService; @Autowired private IPoliceAffairsGridService policeAffairsGridService; @Override public IPage<DoorplateAddressVO> selectDoorplateAddressPage(IPage<DoorplateAddressVO> page, DoorplateAddressVO doorplateAddress) { @@ -125,21 +129,21 @@ 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) { if (null != roleName && !roleName.equals("")) { houseParam.setRoleName(roleName); if (roleName.equals("网格员") && !userId.equals("1726859808689696770")) { // 查询对应的网格code stringList = gridService.getGridListByUserId(AuthUtil.getUserId()); } if (roleName.equals("民警")) { // 查询对应的社区编号 communityList = policeAffairsGridService.getCommunityCodeListByUserId(AuthUtil.getUserId()); } } // 查询街道 List<TreeStringNode> townList = baseMapper.getRegionListByGroupTwon(houseParam, stringList, communityList); // 查询社区 @@ -695,7 +699,7 @@ if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) { if (houseParam.getRoleName().equals("民警") && !userId.equals("1726859808689696770")) { // 查询对应的房屋地址code stringList = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); stringList = policeAffairsGridService.getCommunityCodeListByUserId(AuthUtil.getUserId()); } } return stringList; @@ -888,7 +892,7 @@ // 无权限 one.setIsJur(2); // 查询对应的社区code list = communityService.getCommunityCodeListByUserId(AuthUtil.getUserId()); list = policeAffairsGridService.getCommunityCodeListByUserId(AuthUtil.getUserId()); if (null!=list && list.size()>0){ boolean contains = list.contains(one.getNeiCode()); if (contains) { src/main/java/org/springblade/modules/grid/mapper/GridMapper.java
@@ -129,4 +129,11 @@ */ GridEntity getGridByNames(@Param("gridName") String gridName, @Param("communityName") String communityName); /** * 查询用户对应的网格 * @param userId * @return */ List<String> getGridListByUserId(@Param("userId") String userId); } src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml
@@ -192,4 +192,12 @@ and br.name = #{communityName} </select> <!--查询用户对应的网格--> <select id="getGridListByUserId" resultType="java.lang.String"> select jg.grid_code from jczz_grid jg left join jczz_gridman jgm on jgm.grid_code = jg.grid_code and jgm.is_deleted = 0 where jg.is_deleted = 0 and jgm.user_id = #{userId} </select> </mapper> src/main/java/org/springblade/modules/grid/service/IGridService.java
@@ -132,4 +132,11 @@ * @return */ GridEntity getGridByNames(String gridName, String communityName); /** * 查询用户对应的网格 * @param userId * @return */ List<String> getGridListByUserId(Long userId); } src/main/java/org/springblade/modules/grid/service/impl/GridServiceImpl.java
@@ -336,4 +336,14 @@ public GridEntity getGridByNames(String gridName, String communityName) { return baseMapper.getGridByNames(gridName,communityName); } /** * 查询用户对应的网格 * @param userId * @return */ @Override public List<String> getGridListByUserId(Long userId) { return baseMapper.getGridListByUserId(userId.toString()); } } src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -748,8 +748,14 @@ list.remove(deptPcs.getId().toString()); user.setDeptId(String.join(",",list)); } if (!user.getDeptId().contains(dept.getId().toString())) { user.setDeptId(user.getDeptId() + "," + dept.getId()); // 删完后可能就没了 if (!Strings.isBlank(user.getDeptId())) { if (!user.getDeptId().contains(dept.getId().toString())) { user.setDeptId(user.getDeptId() + "," + dept.getId()); } }else { // 删完后的 user.setDeptId(dept.getId().toString()); } }else { if (!user.getDeptId().contains(dept.getId().toString())) {