吉安感知网项目-后端
linwei
2026-04-02 8ac34cbae4ea8cc47194f51389a4e2dddebcc7d5
drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RegionMapper.xml
@@ -101,8 +101,18 @@
    </select>
    <select id="exportRegion" resultType="org.sxkj.system.excel.RegionExcel">
        SELECT *
        FROM blade_region ${ew.customSqlSegment}
        SELECT
            *
        FROM
            blade_region
        <where>
            <if test="regionIds!=null and regionIds.size()>0">
                and id in
                <foreach item="item" index="index" collection="regionIds" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>
    <!--查询parentCode 长度少于12 的-->
@@ -118,13 +128,14 @@
        FROM blade_region
        where length(parent_code) &lt; 12 limit 0,#{size}
    </select>
    <select id="selectRegionPage" resultType="org.sxkj.system.vo.RegionVO">
        SELECT
            id,
            code,
            parent_code,
            ancestors,
            `name`,
            name,
            province_code,
            province_name,
            city_code,
@@ -139,7 +150,7 @@
            type,
            sort,
            remark,
            `status`,
            status,
            CASE
            WHEN
                region_level = '5' THEN town_name
@@ -147,27 +158,35 @@
                region_level = '4' THEN district_name
            WHEN
                region_level = '3' THEN city_name
            WHEN
                region_level = '2' THEN province_name
            ELSE NULL
            END AS parent_name
        FROM
            blade_region
        <where>
                city_code = '360800000000'
                and region_level > '2'
            <if test="param2.status!=null">
                and status = #{param1.status}
                and status = #{param2.status}
            </if>
            <if test="param2.cityCode!=null and param2.cityCode!='' ">
                and city_code like concat(concat('%', #{param2.cityCode}),'%')
                and code like concat(concat('%', #{param2.cityCode}),'%')
            </if>
            <if test="param2.districtName!=null and param2.districtName!=''">
                and district_name like concat(concat('%', #{param2.districtName}),'%')
                and name like concat(concat('%', #{param2.districtName}),'%')
            </if>
            <if test="param2.parentName!=null and param2.parentName!=''">
                and parent_name like concat(concat('%', #{param2.parentName}),'%')
                and (
                (region_level = '5' AND town_name LIKE CONCAT(CONCAT('%', #{param2.parentName}), '%'))
                OR (region_level = '4' AND district_name LIKE CONCAT(CONCAT('%', #{param2.parentName}), '%'))
                OR (region_level = '3' AND city_name LIKE CONCAT(CONCAT('%', #{param2.parentName}), '%'))
                )
            </if>
            <if test="param2.regionLevel!=null">
                and region_level = #{param2.regionLevel}
            </if>
                ORDER BY create_time DESC
        </where>
                ORDER BY create_time DESC
    </select>
</mapper>