From 150c3d0b972f93869b6180f59ce03f46774dbe06 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Tue, 27 Jan 2026 20:33:06 +0800
Subject: [PATCH] 机构和区域优化

---
 drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RegionMapper.xml |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RegionMapper.xml b/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RegionMapper.xml
index f720da2..9870a1a 100644
--- a/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RegionMapper.xml
+++ b/drone-service/drone-system/src/main/java/org/sxkj/system/mapper/RegionMapper.xml
@@ -118,6 +118,7 @@
         FROM blade_region
         where length(parent_code) &lt; 12 limit 0,#{size}
     </select>
+
     <select id="selectRegionPage" resultType="org.sxkj.system.vo.RegionVO">
         SELECT
             id,
@@ -162,12 +163,16 @@
                 and district_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>

--
Gitblit v1.9.3