From 31b6aefacbee9dde61be6afcb7c6dbbf7c6baa7d Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Tue, 02 Jan 2024 17:51:17 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 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 3b7ff9c..fd473e7 100644
--- a/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
@@ -102,4 +102,52 @@
         SELECT * FROM blade_region ${ew.customSqlSegment}
     </select>
 
+    <!--根据父编号查询所有的下级-->
+    <select id="getTreeList" resultType="org.springblade.common.node.TreeStringNode">
+        SELECT
+        code as id,
+        parent_code as parentId,
+        name
+        FROM blade_region where district_code = '361102'
+        <if test="parentCode!=null">
+            and parent_code = #{parentCode}
+        </if>
+        <if test="regionCode!=null and regionCode!=''">
+            and code like concat('%',#{regionCode},'%')
+        </if>
+    </select>
+
+    <!--根据当前编号查询-->
+    <select id="getTownTree" resultType="org.springblade.common.node.TreeStringNode">
+        SELECT
+        code as id,
+        parent_code as parentId,
+        name
+        FROM blade_region where district_code = '361102'
+        and region_level = 4
+        <if test="regionCode!=null  and regionCode!=''">
+            and code = #{regionCode}
+        </if>
+        union
+        SELECT
+        code as id,
+        parent_code as parentId,
+        name
+        FROM blade_region where district_code = '361102'
+        and region_level = 4
+        <if test="regionCode!=null  and regionCode!=''">
+            and parent_code = #{regionCode}
+        </if>
+    </select>
+
+    <!--树列表(包含省市县三级)-->
+    <select id="getBaseTree" resultType="org.springblade.common.node.TreeStringNode">
+        SELECT
+        code as id,
+        parent_code as parentId,
+        name
+        FROM blade_region
+        where region_level >0 and region_level &lt;4
+    </select>
+
 </mapper>

--
Gitblit v1.9.3