From 61153d869fddb7d2a429b862b5b2831910464fe1 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 03 Sep 2021 17:58:29 +0800
Subject: [PATCH] 1.辖区
---
src/main/java/org/springblade/modules/jurisdiction/mapper/JurisdictionMapper.xml | 110 +++++++++++++++++++++++++++++++-----------------------
1 files changed, 63 insertions(+), 47 deletions(-)
diff --git a/src/main/java/org/springblade/modules/jurisdiction/mapper/JurisdictionMapper.xml b/src/main/java/org/springblade/modules/jurisdiction/mapper/JurisdictionMapper.xml
index a186876..90cf53b 100644
--- a/src/main/java/org/springblade/modules/jurisdiction/mapper/JurisdictionMapper.xml
+++ b/src/main/java/org/springblade/modules/jurisdiction/mapper/JurisdictionMapper.xml
@@ -35,15 +35,15 @@
<select id="lazyList" resultMap="deptVOResultMap">
SELECT
- dept.* ,
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
+ dept.* ,
+ (
+ SELECT
+ CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
+ FROM
sys_jurisdiction
- WHERE
- parent_id = dept.id and is_deleted = 0
- ) AS "has_children"
+ WHERE
+ parent_id = dept.id and is_deleted = 0
+ ) AS "has_children"
FROM
sys_jurisdiction dept
WHERE dept.is_deleted = 0
@@ -68,21 +68,21 @@
</if>
</select>
- <select id="lazyTree" resultMap="treeNodeResultMap" >
+ <select id="lazyTree" resultMap="treeNodeResultMap">
SELECT
- dept.id,
- dept.parent_id,
- dept.dept_name AS title,
- dept.id AS "value",
- dept.id AS "key",
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
+ dept.id,
+ dept.parent_id,
+ dept.dept_name AS title,
+ dept.id AS "value",
+ dept.id AS "key",
+ (
+ SELECT
+ CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
+ FROM
sys_jurisdiction
- WHERE
- parent_id = dept.id and is_deleted = 0
- ) AS "has_children"
+ WHERE
+ parent_id = dept.id and is_deleted = 0
+ ) AS "has_children"
FROM
sys_jurisdiction dept
WHERE dept.is_deleted = 0
@@ -94,7 +94,7 @@
</if>
</select>
- <select id="lazyTrees" resultMap="treeNodeResultMap" >
+ <!--<select id="lazyTrees" resultMap="treeNodeResultMap" >
SELECT
dept.id,
dept.parent_id,
@@ -112,31 +112,47 @@
FROM
sys_jurisdiction dept
WHERE dept.is_deleted = 0
- </select>
- <select id="lazyTreeJu" resultMap="treeNodeResultMap" >
- SELECT
- dept.id,
- dept.parent_id,
- dept.dept_name AS title,
- dept.id AS "value",
- dept.id AS "key",
- (
- SELECT
- CASE
+ </select>-->
- WHEN COUNT
- ( 1 ) > 0 THEN
- 1 ELSE 0
- END
- FROM
- sys_jurisdiction
- WHERE
- parent_id = dept.id
- AND is_deleted = 0
- ) AS "has_children"
- FROM
- sys_jurisdiction dept
- WHERE
- dept.is_deleted = 0
+ <select id="lazyTrees" resultMap="treeNodeResultMap">
+ SELECT dept.id,
+ dept.parent_id,
+ dept.dept_name AS title,
+ dept.id AS "value",
+ dept.id AS "key",
+ (
+ SELECT CASE WHEN count(1) > 0 THEN 0 ELSE 1 END
+ FROM sys_jurisdiction
+ WHERE parent_id = dept.id
+ and is_deleted = 0
+ ) AS "has_children"
+ FROM sys_jurisdiction dept
+ WHERE (
+ SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
+ FROM sys_jurisdiction
+ WHERE parent_id = dept.id
+ and is_deleted = 0
+ ) = 1
+ </select>
+ <select id="lazyTreeJu" resultMap="treeNodeResultMap">
+ SELECT dept.id,
+ dept.parent_id,
+ dept.dept_name AS title,
+ dept.id AS "value",
+ dept.id AS "key",
+ (
+ SELECT CASE
+
+ WHEN COUNT
+ (1) > 0 THEN
+ 1
+ ELSE 0
+ END
+ FROM sys_jurisdiction
+ WHERE parent_id = dept.id
+ AND is_deleted = 0
+ ) AS "has_children"
+ FROM sys_jurisdiction dept
+ WHERE dept.is_deleted = 0
</select>
</mapper>
--
Gitblit v1.9.3