linwe
2023-12-01 5d5cd3ad979a0b85ab8c7034dcad1663fdcf71be
src/main/java/org/springblade/modules/doorplateAddress/mapper/DoorplateAddressMapper.xml
@@ -5,7 +5,7 @@
    <!--过滤网格数据-->
    <sql id="filterHouseGrid">
        <if test="houseParam.roleName!=null and houseParam.roleName!=''">
            <if test="houseParam.roleName=='网格员'">
            <if test="houseParam.roleName=='网格员' and houseParam.userId!='1726859808689696770'">
                <choose>
                    <when test="list != null and list.size()>0">
                        and address_code in
@@ -40,23 +40,29 @@
    <!--查询区域数据-街道-->
    <select id="getRegionListByGroupTwon" resultType="org.springblade.common.node.TreeNode" >
    <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"/>
        group by town_street_code,town_street_name
    </select>
    <!--查询区域数据-社区-->
    <select id="getRegionListByGroupNei" resultType="org.springblade.common.node.TreeNode" >
    <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
        <if test="houseParam.userId!=null and houseParam.userId!='' and houseParam.userId=='1726859808689696770'">
            and nei_name = '万达社区居民委员会'
        </if>
        <include refid="filterHouseGrid"/>
        group by nei_code,nei_name,town_street_code
    </select>
    <!--根据社区名称查询小区集合-->
    <select id="getDistrictList" resultType="org.springblade.common.node.TreeNode" >
    <select id="getDistrictList" resultType="org.springblade.common.node.TreeStringNode" >
        select aoi_code as id,aoi_name as name,1 as addressType from jczz_doorplate_address
        where 1=1
        and aoi_name !=''
@@ -98,10 +104,26 @@
        <include refid="filterHouseGrid"/>
        group by nei_code
        )
        union all
        (
        select '企业商超' as id,'企业商超' as name,4 as addressType from jczz_place_rel jpl
        join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
        where jpl.is_deleted = 0
        <if test="houseParam.communityName!=null and houseParam.communityName!=''">
            and community_name like concat('%',#{houseParam.communityName},'%')
        </if>
        <if test="houseParam.gridName!=null and houseParam.gridName!=''">
            and grid_name like concat('%',#{houseParam.gridName},'%')
        </if>
        <if test="houseParam.code != null and houseParam.code!=''">
            and community_code = #{houseParam.code}
        </if>
        limit 1
        )
    </select>
    <!--根据小区名称查询楼栋/商铺集合-->
    <select id="getBuildingList" resultType="org.springblade.common.node.TreeNode" >
    <select id="getBuildingList" resultType="org.springblade.common.node.TreeStringNode" >
        (
            select building_code as id,ifnull(building_name,'1栋') as name,1 as addressType from jczz_doorplate_address
            where 1=1
@@ -198,7 +220,7 @@
    </select>
    <!--根据社区查询街路巷集合-->
    <select id="getStreetRuList" resultType="org.springblade.common.node.TreeNode" >
    <select id="getStreetRuList" resultType="org.springblade.common.node.TreeStringNode" >
        select street_ru_code as id,street_ru_name as name,3 as addressType from jczz_doorplate_address
        where 1=1
        and aoi_code is null
@@ -215,12 +237,14 @@
    <!--根据街路巷编号查询街路巷门牌名称集合-->
    <select id="getDoorplateNameList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode">
      select address_code as addressCode,
      IFNULL(CONCAT(doorplate_num,sub_door_plate_no), IF(doorplate_num IS NULL, sub_door_plate_no, doorplate_num)) as floor
      IFNULL(CONCAT(doorplate_num,sub_door_plate_no), IF(doorplate_num IS NULL, sub_door_plate_no, doorplate_num)) as floor,
      3 as addressType
      from jczz_doorplate_address
      where 1=1
      and street_ru_code = #{houseParam.code}
      and nei_code = #{houseParam.name}
      and aoi_code is null
      and doorplate_type = '中门牌'
      <include refid="filterHouseGrid"/>
      order by doorplate_num,sub_door_plate_no
    </select>
@@ -257,7 +281,11 @@
    <!--查询社区信息-->
    <select id="getAllDoorplateAddress" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
        select * from jczz_doorplate_address where nei_name = #{name}
        select * from jczz_doorplate_address
        where 1=1
        <if test="name!=null and name!=''">
            and nei_name = #{name}
        </if>
    </select>
    <!--获取房屋树-->
@@ -325,4 +353,88 @@
        )
    </select>
    <!--查询商超-->
    <select id="getPlaceRelList" resultType="org.springblade.common.node.TreeStringNode">
        select building_name as id,building_name as name,4 as addressType from jczz_place_rel jpl
        join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
        where jpl.is_deleted = 0
        <if test="houseParam.communityName!=null and houseParam.communityName!=''">
            and community_name like concat('%',#{houseParam.communityName},'%')
        </if>
        <if test="houseParam.gridName!=null and houseParam.gridName!=''">
            and grid_name like concat('%',#{houseParam.gridName},'%')
        </if>
        group by building_name
    </select>
    <!--查询商超详情集合-->
    <select id="getPlaceRelDetailList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode">
        select jp.id as addressCode,
        doorplate_num as floor,
        4 as addressType
        from jczz_place_rel jpl
        join jczz_place jp on jpl.place_id = jp.id and jp.is_deleted = 0
        where jpl.is_deleted = 0
        <if test="houseParam.communityName!=null and houseParam.communityName!=''">
            and community_name like concat('%',#{houseParam.communityName},'%')
        </if>
        <if test="houseParam.gridName!=null and houseParam.gridName!=''">
            and grid_name like concat('%',#{houseParam.gridName},'%')
        </if>
        <if test="houseParam.buildingName!=null and houseParam.buildingName!=''">
            and building_name = #{houseParam.buildingName}
        </if>
    </select>
    <!--查询小区集合-->
    <select id="getAoiList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
        select nei_code,aoi_code,ifnull(aoi_name,sub_aoi) as aoi_name,x,y,address_name from  jczz_doorplate_address
        where 1=1
        <choose>
            <when test="list != null and list.size()>0">
                and id in
                <foreach collection="list" item="id" separator ="," open="("  close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and id in ('')
            </otherwise>
        </choose>
    </select>
    <!--查询所有的地址表id集合-->
    <select id="getAoiCodeList" resultType="java.lang.Long">
        select
        max(id)
        from jczz_doorplate_address
        where aoi_code != "" and aoi_name !=""
        GROUP BY aoi_code
        union all
        (
        select
        max(id)
        from jczz_doorplate_address
        where aoi_code != "" and sub_aoi != ""
        group by aoi_code
        )
    </select>
    <!--查询所有的地址表和场所表差集集合(小区和非小区的)-->
    <select id="getPlaceList" resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
        select jda.* from jczz_doorplate_address jda
        left join jczz_place jp on jp.house_code = jda.address_code and jp.is_deleted =0
        where 1=1
        and jp.house_code is null
        and (doorplate_type = '小门牌' or (doorplate_type = '中门牌' and address_level = 1))
        union all
        (
        select jda.* from jczz_doorplate_address jda
        left join jczz_place jp on jp.house_code = jda.address_code and jp.is_deleted =0
        where 1=1
        and jp.house_code is null
        and aoi_code is null
      and doorplate_type='中门牌'
        )
    </select>
</mapper>