| | |
| | | return null; |
| | | } |
| | | List<String> regionCodeList = CacheUtil.get(SYS_CACHE, REGION_CHILDCODES_CODE, regionCode, List.class); |
| | | if (regionCodeList == null) { |
| | | if (regionCodeList == null || regionCodeList.size()==0) { |
| | | regionCodeList = new ArrayList<>(); |
| | | List<Region> deptChild = getRegionChild(regionCode); |
| | | if (deptChild != null) { |
| | | List<String> collect = deptChild.stream().map(Region::getCode).collect(Collectors.toList()); |
| | | regionCodeList.addAll(collect); |
| | | } |
| | | // regionCodeList.add(regionCode); |
| | | regionCodeList.add(regionCode); |
| | | CacheUtil.put(SYS_CACHE, REGION_CHILDCODES_CODE, regionCode, regionCodeList); |
| | | } |
| | | return regionCodeList; |
| | |
| | | @ApiModelProperty(value = "网格id") |
| | | private Integer gridId; |
| | | /** |
| | | * 网格编号 |
| | | */ |
| | | @ApiModelProperty(value = "网格编号") |
| | | private String gridCode; |
| | | /** |
| | | * 关联用户表id |
| | | */ |
| | | @ApiModelProperty(value = "关联用户表id") |
| | |
| | | bu.phone AS gridPhone |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm on jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jg.id = jgr.grid_id |
| | | LEFT JOIN jczz_gridman jgm on jg.grid_code = jgm.grid_code |
| | | LEFT JOIN blade_region br on br.code = jg.community_code |
| | | LEFT JOIN jczz_place_rel jpr ON locate( jpr.community_name, br.name )> 0 |
| | | AND locate( jpr.grid_name, jg.grid_name )> 0 |
| | |
| | | bu.real_name as createUserName |
| | | from jczz_grid_work_log jgwl |
| | | left join jczz_household jh on jgwl.household_id = jh.id and jh.is_deleted = 0 |
| | | left join jczz_house jhs on jhs.house_code = jh.house_code and jhs.is_deleted = 0 |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code |
| | | LEFT JOIN jczz_grid_range jgr on jgr.house_code=jda.address_code |
| | | LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_grid jg on jhs.grid_code = jg.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN blade_user bu on bu.id = jgwl.create_user and bu.is_deleted = 0 |
| | | where jgwl.is_deleted = 0 |
| | | <if test="gridWorkLog.type !=null"> |
| | |
| | | </if> |
| | | <if test="gridWorkLog.personType !=null"> |
| | | and jgwl.person_type = #{gridWorkLog.personType} |
| | | </if> |
| | | <if test="gridWorkLog.gridId !=null"> |
| | | and jgr.grid_id = #{gridWorkLog.gridId} |
| | | </if> |
| | | <if test="gridWorkLog.name !=null and gridWorkLog.name!=''"> |
| | | and jh.name like concat('%',#{gridWorkLog.name},'%') |
| | |
| | | </if> |
| | | <if test="gridWorkLog.neiName!=null and gridWorkLog.neiName!=''"> |
| | | and jda.nei_name like concat('%',#{gridWorkLog.neiName},'%') |
| | | </if> |
| | | <if test="gridWorkLog.gridId !=null"> |
| | | and jg.id = #{gridWorkLog.gridId} |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | |
| | | <select id="getGridWorkCountHandleCount" resultType="java.lang.Integer"> |
| | | select count(*) from jczz_grid_work_log jgwl |
| | | left join jczz_household jh on jgwl.household_id = jh.id and jh.is_deleted = 0 |
| | | left join jczz_house jhs on jhs.house_code=jh.house_code |
| | | left join jczz_house jhs on jhs.house_code=jh.house_code and jhs.is_deleted = 0 |
| | | where jgwl.is_deleted = 0 |
| | | <if test="status!=null"> |
| | | and jgwl.status = #{status} |
| | |
| | | br.name as communityName, |
| | | br.town_name as townName |
| | | from jczz_gridman jgm |
| | | left join jczz_grid jg on jg.id = jgm.grid_id and jg.is_deleted = 0 |
| | | left join jczz_grid jg on jg.grid_code = jgm.grid_code and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | where jgm.is_deleted = 0 |
| | | <if test="gridman.gridmanName!=null and gridman.gridmanName!=''"> |
| | |
| | | <select id="getGridStatistics" resultType="java.lang.Integer"> |
| | | SELECT count(1) number |
| | | FROM jczz_gridman jgm |
| | | LEFT JOIN jczz_grid jg ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid jg ON jg.grid_code = jgm.grid_code |
| | | WHERE jg.community_code = #{code} |
| | | AND jg.is_deleted = 0 |
| | | <if test="userId!=null and roleType == '1'"> |
| | |
| | | jda.aoi_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jgr.house_code |
| | | LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | |
| | | jda.aoi_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jgr.house_code |
| | | LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | |
| | | select |
| | | jgm.*,jg.community_code communityCode |
| | | from jczz_gridman jgm |
| | | left join jczz_grid jg on jg.id = jgm.grid_id and jg.is_deleted = 0 |
| | | left join jczz_grid jg on jg.grid_code = jgm.grid_code and jg.is_deleted = 0 |
| | | where jgm.is_deleted = 0 |
| | | and jgm.id = #{gridman.id} |
| | | </select> |
| | |
| | | </select> |
| | | |
| | | <select id="getGridManByCode" resultType="org.springblade.modules.system.entity.User"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | blade_user bu |
| | | LEFT JOIN jczz_gridman jgm ON bu.id = jgm.user_id |
| | | LEFT JOIN jczz_grid jg ON jgm.grid_id = jg.id |
| | | WHERE |
| | | jg.community_code IN ( SELECT jg.community_code FROM jczz_grid jg LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id WHERE jgr.house_code = #{houseCode} ) |
| | | AND bu.is_deleted = 0 |
| | | SELECT |
| | | bu.* |
| | | FROM |
| | | blade_user bu |
| | | LEFT JOIN jczz_gridman jgm ON bu.id = jgm.user_id |
| | | LEFT JOIN jczz_grid jg ON jgm.grid_code = jg.grid_code |
| | | WHERE |
| | | jg.community_code IN |
| | | ( |
| | | SELECT jg.community_code FROM jczz_grid jg LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE jgr.house_code = #{houseCode} |
| | | ) |
| | | AND bu.is_deleted = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | select |
| | | jh.*, |
| | | jhl.id as cid,jhl.*,jhl.remark as cremark, |
| | | br.code as neiCode,jg.id as gridId,br.town_code as streetCode |
| | | br.code as neiCode,br.town_code as streetCode |
| | | from jczz_house jh |
| | | left join jczz_user_house_label jhl on jh.house_code = jhl.house_code and jhl.lable_type = 2 |
| | | left join jczz_grid_range jgr on jgr.house_code = jh.house_code |
| | | left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | left join jczz_grid jg on jg.grid_code = jgr.grid_code and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | where jh.is_deleted = 0 |
| | | <if test="house.houseCode!=null and house.houseCode!=''"> |
| | |
| | | if(jhr.termination_time is null,if(date_format(jhr.due_time,'%Y-%m-%d') >= date_format(now(),'%Y-%m-%d'),0,1),2) as status |
| | | FROM jczz_house_rental jhr |
| | | JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | JOIN jczz_house jh ON jh.house_code = jhr.house_code |
| | | LEFT JOIN jczz_grid_range jgr on jgr.house_code=jda.address_code |
| | | LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | JOIN jczz_house jh ON jh.house_code = jhr.house_code and jh.is_deleted = 0 |
| | | LEFT JOIN jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN ( |
| | | SELECT jht.housing_rental_id,jht.name as tenantName,jht.phone_number as phone |
| | | FROM jczz_household jht RIGHT JOIN ( |
| | |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | List<HouseVO> houseVOS = baseMapper.selectHousePage(page, house,regionChildCodesList,isAdministrator); |
| | | // 遍历查询网格 |
| | | // for (HouseVO houseVO : houseVOS) { |
| | | // // 设置对应的网格名称 |
| | | // GridVO gridVO = gridService.getGridDetailByHouseCode(houseVO.getHouseCode()); |
| | | // if (null!= gridVO){ |
| | | // houseVO.setGridName(gridVO.getGridName()); |
| | | // } |
| | | // } |
| | | return page.setRecords(houseVOS); |
| | | } |
| | | |
| | |
| | | jp.place_name AS placeName |
| | | FROM |
| | | jczz_place_ext jpe |
| | | LEFT JOIN jczz_place jp ON jpe.place_id = jp.id |
| | | AND jp.is_deleted = 0 |
| | | LEFT JOIN jczz_grid_range jgr on jgr.house_code=jp.house_code |
| | | LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id |
| | | LEFT JOIN jczz_place jp ON jpe.place_id = jp.id AND jp.is_deleted = 0 |
| | | LEFT JOIN jczz_grid jg ON jp.grid_code = jg.grid_code AND jg.is_deleted = 0 |
| | | WHERE |
| | | jpe.is_deleted = 0 |
| | | <if test="isAdministrator==2"> |
| | |
| | | * @param page |
| | | * @param place |
| | | * @param houseCodeList |
| | | * @param regionChildCodesList |
| | | * @param isAdministrator |
| | | * @return |
| | | */ |
| | | List<PlaceVO> selectPlacePage(IPage page, |
| | | @Param("place") PlaceVO place, |
| | | @Param("houseCodeList") List<String> houseCodeList, |
| | | @Param("regionChildCodesList") List<String> regionChildCodesList, |
| | | @Param("isAdministrator") Integer isAdministrator); |
| | | |
| | |
| | | <if test="place.isPerfect==2"> |
| | | and jp.status = 2 |
| | | </if> |
| | | <if test="houseCodeList != null and houseCodeList.size()>0"> |
| | | and jp.house_code in |
| | | <foreach collection="houseCodeList" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jg.community_code in |
| | | and jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jg.community_code in ('') |
| | | and jg.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | |
| | | br.name neiName, |
| | | FALSE AS hasChildren |
| | | FROM jczz_place jp |
| | | LEFT JOIN jczz_grid_range jgr ON jp.house_code = jgr.house_code |
| | | LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id |
| | | LEFT JOIN jczz_grid jg on jp.grid_code = jg.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN blade_region br on br.code = jg.community_code |
| | | where 1 = 1 |
| | | and jp.is_deleted = 0 |
| | |
| | | public IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | List<PlaceVO> placeVOS = baseMapper.selectPlacePage(page, place,regionChildCodesList,isAdministrator); |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=place.getRoleName() && !place.getRoleName().equals("")){ |
| | | if (place.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectPlacePage(page, place,list,regionChildCodesList,isAdministrator); |
| | | // 返回 |
| | | return page.setRecords(placeVOS); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<Region> getCodeLess12DataList(); |
| | | |
| | | /** |
| | | * 查询下级区域(拼接网格) |
| | | * @param regionCode |
| | | * @return |
| | | */ |
| | | List<Region> getRegionChildList(@Param("regionCode") String regionCode); |
| | | } |
| | |
| | | where length(parent_code) < 12 |
| | | </select> |
| | | |
| | | <!--查询下级区域(拼接网格)--> |
| | | <select id="getRegionChildList" resultType="org.springblade.modules.system.entity.Region"> |
| | | SELECT |
| | | code,parent_code,name,ancestors,region_level,sort |
| | | FROM blade_region |
| | | where ancestors like concat('%',#{regionCode},'%') |
| | | union all |
| | | ( |
| | | SELECT |
| | | jg.grid_code as code, |
| | | jg.community_code as parent_code, |
| | | jg.grid_name as name, |
| | | '' as ancestors, |
| | | 6 as region_level, |
| | | jg.sort |
| | | FROM blade_region br |
| | | right join jczz_grid jg on jg.community_code = br.village_code and jg.is_deleted = 0 |
| | | where br.ancestors like concat('%',#{regionCode},'%') |
| | | ) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询下级区域 |
| | | * 查询下级区域(拼接网格) |
| | | * @param regionCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Region> getRegionChild(String regionCode) { |
| | | return baseMapper.selectList(Wrappers.<Region>query().lambda().like(Region::getAncestors, regionCode)); |
| | | return baseMapper.getRegionChildList(regionCode); |
| | | } |
| | | } |