From 494aeb58eb885b40ab2fdb083aaa79007bb79ae2 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Fri, 19 Jan 2024 17:46:23 +0800
Subject: [PATCH] bug 修复

---
 src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml |   41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml b/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
index 5d9b55e..60f6972 100644
--- a/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
@@ -105,26 +105,47 @@
     <!--根据父编号查询所有的下级-->
     <select id="getTreeList" resultType="org.springblade.common.node.TreeStringNode">
         <if test="region.cityCode!=null and region.cityCode!=''">
-            SELECT
-            code as id,
-            parent_code as parentId,
-            name
-            FROM blade_region
-            where code = #{region.cityCode}
-            union all
+        SELECT
+        code as id,
+        parent_code as parentId,
+        name,
+        sort
+        FROM blade_region
+        where code = #{region.cityCode}
+        union all
+        select
+        grid_code as id,
+        community_code as parentId,
+        grid_name as name,
+        jg.sort
+        FROM jczz_grid jg
+        left join blade_region br on br.village_code = jg.community_code and br.region_level = 5
+        where jg.is_deleted = 0 and br.city_code = #{region.cityCode}
+        union all
         </if>
         SELECT
         code as id,
         parent_code as parentId,
-        name
+        name,
+        sort
         FROM blade_region
         where 1=1
         and district_code = '361102000000'
         <if test="region.parentCode!=null and region.parentCode!=''">
             and parent_code = #{region.parentCode}
         </if>
-        <if test="region.regionCode!=null and region.regionCode!=''">
-            and code like concat('%',#{region.regionCode},'%')
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                    and code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                </when>
+                <otherwise>
+                    and code in ('')
+                </otherwise>
+            </choose>
         </if>
     </select>
 

--
Gitblit v1.9.3