From 65342a7bdf0aebc581ce51dc08c65d1c3b6d33dd Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Thu, 15 Jul 2021 10:06:00 +0800
Subject: [PATCH] 1.机构树数据
---
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml | 45 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
index 72aa7d8..0d3801a 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -92,7 +92,10 @@
FROM
blade_dept dept
WHERE
- dept.parent_id = #{param2} AND dept.is_deleted = 0
+ dept.is_deleted = 0
+ <if test="param2!=null and param2!=0">
+ and dept.parent_id = #{param2}
+ </if>
<if test="param1!=null and param1!=''">
and dept.tenant_id = #{param1}
</if>
@@ -142,15 +145,21 @@
<select id="selectIn" resultType="java.util.HashMap">
SELECT
- id,
- dept_name
+ id as deptid,
+ dept_name as deptname
FROM
- blade_dept
+ blade_dept where is_deleted = 0
</select>
<!--统计单位类型数量-->
<select id="selectCount" resultType="java.util.HashMap">
- SELECT dept.id as jurisdiction,dept.dept_name AS title FROM blade_dept dept WHERE dept.dept_name like concat(concat('%', #{name}),'%')
+ SELECT
+ id as jurisdiction,
+ dept_name AS title
+ FROM
+ sys_jurisdiction
+ WHERE
+ is_deleted = 0 AND parent_id!=0
</select>
<select id="selectHold" resultType="java.util.HashMap">
@@ -167,5 +176,29 @@
<select id="selectId" resultType="java.util.HashMap">
SELECT id FROM blade_dept WHERE parent_id =#{id} and is_deleted = 0
</select>
-
+ <select id="securityLazyTree" 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
+ blade_dept
+ WHERE
+ parent_id = dept.id and is_deleted = 0
+ ) AS "has_children"
+ FROM
+ blade_dept dept
+ WHERE
+ dept.parent_id = #{param2} AND dept.is_deleted = 0
+ and dept_category = 1
+ <if test="param1!=null and param1!=''">
+ and dept.tenant_id = #{param1}
+ </if>
+ ORDER BY dept.sort
+ </select>
</mapper>
--
Gitblit v1.9.3