| | |
| | | br.town_name as townStreetName,br.name as neiName, |
| | | jg.grid_name |
| | | from jczz_house jh |
| | | 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 = jh.grid_code and jg.is_deleted = 0 |
| | | left join blade_region br on br.code = jg.community_code |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | <where> |
| | | <if test="house.id != null ">and jh.id = #{house.id}</if> |
| | | <if test="house.streetCode != null and house.streetCode != ''"> |
| | |
| | | <if test="house.neiName!=null and house.neiName!=''"> |
| | | and br.name like concat('%',#{house.neiName},'%') |
| | | </if> |
| | | <if test="house.address!=null and house.address!=''"> |
| | | and jh.address like concat('%',#{house.address},'%') |
| | | </if> |
| | | <if test="house.houseName != null and house.houseName != ''">and jh.house_name like |
| | | concat('%',#{house.houseName},'%') |
| | | </if> |
| | |
| | | <if test="house.buildingNo != null ">and jh.building_no = #{house.buildingNo}</if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jg.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | <when test="house.roleName != null and house.roleName != ''"> |
| | | <if test="house.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jh.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jh.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="house.roleName=='mj'"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" |
| | | separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jpag.community_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | and jg.community_code in ('') |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and |
| | | ( |
| | | jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | or |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | and |
| | | ( |
| | | jg.grid_code in ('') |
| | | or |
| | | jpag.community_code in ('') |
| | | ) |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | |
| | | </if> |
| | | and jh.is_deleted = 0 |
| | | ORDER BY |
| | | jh.update_time DESC |
| | | jh.update_time desc,jh.id desc |
| | | </where> |
| | | |
| | | |
| | |
| | | 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 = jh.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!=''"> |
| | |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | jc.res_police_user_id like concat('%',#{userId},'%')) |
| | | ) |
| | | </if> |
| | | ) a |
| | |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | jc.res_police_user_id like concat('%',#{userId},'%')) |
| | | ) |
| | | </if> |
| | | ) a |
| | |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | jc.res_police_user_id like concat('%',#{userId},'%')) |
| | | ) |
| | | </if> |
| | | </select> |
| | |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | jc.res_police_user_id like concat('%',#{userId},'%')) |
| | | ) |
| | | </if> |
| | | ) a |
| | |
| | | |
| | | </select> |
| | | |
| | | <select id="labelStatistics" resultType="java.util.Map"> |
| | | SELECT |
| | | jl.id AS id, |
| | | jl.parent_id AS parentId, |
| | | jl.label_name AS name, |
| | | jl.sort, |
| | | (SELECT |
| | | count( DISTINCT jhl.house_code ) |
| | | FROM |
| | | jczz_user_house_label jhl |
| | | LEFT JOIN jczz_house jh ON jhl.house_code = jh.house_code |
| | | LEFT JOIN jczz_grid jg ON jg.grid_code = jh.grid_code |
| | | AND jg.is_deleted = 0 |
| | | LEFT JOIN blade_region br ON br.CODE = jg.community_code |
| | | <where> |
| | | <if test="house.id != null ">and jh.id = #{house.id}</if> |
| | | <if test="house.streetCode != null and house.streetCode != ''"> |
| | | and jda.town_street_code like concat('%',#{house.streetCode},'%') |
| | | </if> |
| | | <if test="house.houseCode != null and house.houseCode != ''">and jh.house_code = #{house.houseCode}</if> |
| | | <if test="house.districtCode != null and house.districtCode != ''">and jh.district_code = |
| | | #{house.districtCode} |
| | | </if> |
| | | <if test="house.districtName != null and house.districtName != ''"> |
| | | and jh.district_name like concat('%',#{house.districtName},'%') |
| | | </if> |
| | | <if test="house.townStreetName!=null and house.townStreetName!=''"> |
| | | and br.town_name like concat('%',#{house.townStreetName},'%') |
| | | </if> |
| | | <if test="house.neiName!=null and house.neiName!=''"> |
| | | and br.name like concat('%',#{house.neiName},'%') |
| | | </if> |
| | | <if test="house.address!=null and house.address!=''"> |
| | | and jh.address like concat('%',#{house.address},'%') |
| | | </if> |
| | | <if test="house.houseName != null and house.houseName != ''">and jh.house_name like |
| | | concat('%',#{house.houseName},'%') |
| | | </if> |
| | | <if test="house.phone != null and house.phone != ''">and jh.phone = #{house.phone}</if> |
| | | <if test="house.area != null ">and jh.area = #{house.area}</if> |
| | | <if test="house.propertyPrice != null ">and jh.property_price = #{house.propertyPrice}</if> |
| | | <if test="house.serviceDue != null ">and jh.service_due = #{house.serviceDue}</if> |
| | | <if test="house.floor != null ">and jh.floor = #{house.floor}</if> |
| | | <if test="house.building != null and house.building != ''">and jh.building = #{house.building}</if> |
| | | <if test="house.unit != null and house.unit != ''">and jh.unit = #{house.unit}</if> |
| | | <if test="house.room != null and house.room != ''">and jh.room = #{house.room}</if> |
| | | <if test="house.buildingNo != null ">and jh.building_no = #{house.buildingNo}</if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jg.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | <if test="house.parentId != null "> |
| | | <if test="house.labelId != null "> |
| | | AND jl.id = #{house.labelId} |
| | | </if> |
| | | <if test="house.parentId != null "> |
| | | AND jl.parent_id = #{house.parentId} |
| | | </if> |
| | | and jhl.label_id=jl.id |
| | | AND jhl.lable_type = 2 |
| | | AND jhl.label_id IS NOT NULL |
| | | </if> |
| | | and jh.is_deleted = 0 |
| | | </where> |
| | | ) count |
| | | FROM |
| | | jczz_label jl where is_deleted = 0 |
| | | <if test="house.parentId != null "> |
| | | AND jl.parent_id = #{house.parentId} |
| | | </if> |
| | | and jl.id != '1002' |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="labelCommunityStatistics" resultType="java.util.Map"> |
| | | SELECT |
| | | br.code, |
| | | br.name, |
| | | br.id |
| | | FROM |
| | | blade_region br |
| | | <where> |
| | | <if test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | br.code IN |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </if> |
| | | and br.parent_code = '361102' |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getlabelCount" resultType="org.springblade.modules.label.vo.LabelVO"> |
| | | |
| | | SELECT |
| | | jl.label_name, |
| | | ( SELECT |
| | | count( DISTINCT jhl.house_code ) |
| | | FROM |
| | | jczz_user_house_label jhl |
| | | LEFT JOIN jczz_house jh ON jhl.house_code = jh.house_code |
| | | LEFT JOIN jczz_grid jg ON jg.grid_code = jh.grid_code |
| | | AND jg.is_deleted = 0 |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jg.community_code |
| | | LEFT JOIN blade_region br ON br.CODE = jg.community_code |
| | | WHERE |
| | | jhl.lable_type = 2 |
| | | AND jl.id = jhl.label_id |
| | | AND jc.street_code = #{streetCode} |
| | | <if test="house.townStreetName!=null and house.townStreetName!=''"> |
| | | and br.town_name like concat('%',#{house.townStreetName},'%') |
| | | </if> |
| | | <if test="house.neiName!=null and house.neiName!=''"> |
| | | and br.name like concat('%',#{house.neiName},'%') |
| | | </if> |
| | | <if test="house.neiName!=null and house.neiName!=''"> |
| | | and br.name like concat('%',#{house.neiName},'%') |
| | | </if> |
| | | <if test="house.address!=null and house.address!=''"> |
| | | and jh.address like concat('%',#{house.address},'%') |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jg.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | <if test="house.parentId != null "> |
| | | and jh.house_code in ( |
| | | SELECT DISTINCT |
| | | juhl.house_code |
| | | FROM |
| | | jczz_user_house_label juhl |
| | | LEFT JOIN jczz_label jl ON juhl.label_id = jl.id |
| | | WHERE |
| | | juhl.lable_type = 2 |
| | | <if test="house.labelId != null "> |
| | | AND jl.id = #{house.labelId} |
| | | </if> |
| | | <if test="house.parentId != null "> |
| | | AND jl.parent_id = #{house.parentId} |
| | | </if> |
| | | AND juhl.label_id IS NOT NULL |
| | | ) |
| | | </if> |
| | | ) num |
| | | FROM |
| | | jczz_label jl |
| | | WHERE |
| | | jl.parent_id = '1001' |
| | | ORDER BY |
| | | jl.sort DESC |
| | | |
| | | </select> |
| | | |
| | | <!--查询未绑定网格或警格的数据--> |
| | | <select id="getNotBindGridOrJwGridList" resultType="org.springblade.modules.house.entity.HouseEntity"> |
| | | select id,lng,lat from jczz_house where is_deleted = 0 and lng != '' |
| | | <if test="type == 1"> |
| | | and grid_code is null |
| | | </if> |
| | | <if test="type == 2"> |
| | | and jw_grid_code is null |
| | | </if> |
| | | and create_time > '2024-03-20 11:00:00' |
| | | </select> |
| | | |
| | | <!--按房屋标签统计--> |
| | | <select id="getHouseLabelStatistic" resultType="java.util.Map"> |
| | | select a.label_name as labelName,ifnull(b.numbers,0) numbers from |
| | | ( |
| | | select label_name from jczz_label where parent_id = 1001 and is_deleted = 0 |
| | | union all |
| | | select '未知' as label_name |
| | | ) a |
| | | left join ( |
| | | select |
| | | ifnull(juhl.label_name,'未知') labelName, |
| | | count(*) as numbers |
| | | from jczz_doorplate_address jda |
| | | LEFT JOIN jczz_house jh on jda.address_code = jh.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 blade_region br on br.code = jg.community_code |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | LEFT JOIN jczz_user_house_label juhl ON juhl.house_code = jh.house_code and juhl.lable_type = 2 |
| | | where jda.doorplate_type = '户室牌' |
| | | <if test="house.communityCode != null and house.communityCode != ''"> |
| | | and jg.community_code = #{house.communityCode} |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="house.roleName != null and house.roleName != ''"> |
| | | <if test="house.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jh.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jh.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="house.roleName=='mj'"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" |
| | | separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jpag.community_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and |
| | | ( |
| | | jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | or |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | and |
| | | ( |
| | | jg.grid_code in ('') |
| | | or |
| | | jpag.community_code in ('') |
| | | ) |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | group by juhl.label_name |
| | | ) b on a.label_name =b.labelName |
| | | </select> |
| | | |
| | | |
| | | </mapper> |