From d46ca134f82fd106bfbbbd71aef7184805e6d7e7 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Fri, 19 Jan 2024 09:17:54 +0800
Subject: [PATCH] bug 修复
---
src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml | 31 ++++++++++++++++++++++++-------
1 files changed, 24 insertions(+), 7 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 fd473e7..5d9b55e 100644
--- a/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/RegionMapper.xml
@@ -104,16 +104,27 @@
<!--根据父编号查询所有的下级-->
<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
+ </if>
SELECT
code as id,
parent_code as parentId,
name
- FROM blade_region where district_code = '361102'
- <if test="parentCode!=null">
- and parent_code = #{parentCode}
+ 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="regionCode!=null and regionCode!=''">
- and code like concat('%',#{regionCode},'%')
+ <if test="region.regionCode!=null and region.regionCode!=''">
+ and code like concat('%',#{region.regionCode},'%')
</if>
</select>
@@ -123,7 +134,7 @@
code as id,
parent_code as parentId,
name
- FROM blade_region where district_code = '361102'
+ FROM blade_region where district_code = '361102000000'
and region_level = 4
<if test="regionCode!=null and regionCode!=''">
and code = #{regionCode}
@@ -133,7 +144,7 @@
code as id,
parent_code as parentId,
name
- FROM blade_region where district_code = '361102'
+ FROM blade_region where district_code = '361102000000'
and region_level = 4
<if test="regionCode!=null and regionCode!=''">
and parent_code = #{regionCode}
@@ -150,4 +161,10 @@
where region_level >0 and region_level <4
</select>
+ <!--查询parentCode 长度少于12 的-->
+ <select id="getCodeLess12DataList" resultType="org.springblade.modules.system.entity.Region">
+ SELECT * FROM blade_region
+ where length(parent_code) < 12
+ </select>
+
</mapper>
--
Gitblit v1.9.3