From ffa79b721ba96bd12b4ca394b8849a6b0c7bf01e Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 01 Dec 2021 16:17:31 +0800
Subject: [PATCH] 枪支接口修改,部门树修改
---
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml | 142 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 130 insertions(+), 12 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 6d2ae59..646a324 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -103,6 +103,43 @@
</select>
<!--懒加载获取部门树形结构(包含用户数据)-->
+<!-- <select id="lazyTreeUser" resultMap="treeNodeResultMap">-->
+<!-- select DISTINCT * from (-->
+<!-- (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.is_deleted = 0-->
+<!-- )-->
+
+<!-- union-->
+
+<!-- (select-->
+<!-- id,-->
+<!-- dept_id parent_id,-->
+<!-- real_name AS title,-->
+<!-- id AS "value",-->
+<!-- id AS "key",-->
+<!-- 0 as "has_children"-->
+<!-- from blade_user-->
+<!-- )-->
+<!-- )c-->
+<!-- </select> -->
+
+ <!--懒加载获取部门树形结构(包含用户数据)-->
<select id="lazyTreeUser" resultMap="treeNodeResultMap">
select DISTINCT * from (
(SELECT
@@ -121,25 +158,106 @@
) AS "has_children"
FROM
blade_dept dept
+ left join
+ sys_information si
+ on
+ si.departmentid = dept.id
WHERE
dept.is_deleted = 0
+ and si.stats = 2
+ and si.departmentid !=1432626178757275649
+ <if test="parentId!=null and parentId!=0">
+ and si.departmentid = 1111
+ </if>
)
-
- union
-
- (select
- id,
- dept_id parent_id,
- real_name AS title,
- id AS "value",
- id AS "key",
- 0 as "has_children"
- from blade_user
- )
+ <if test="parentId!=null and parentId!=0">
+ union
+ (select
+ bu.id,
+ bu.dept_id parent_id,
+ real_name AS title,
+ bu.id AS "value",
+ bu.id AS "key",
+ 0 as "has_children"
+ from blade_user bu
+ left join
+ blade_dept bd
+ on
+ bd.id = bu.dept_id
+ left join
+ sys_information si
+ on
+ si.departmentid = bd.id
+ where bd.is_deleted = 0
+ and bu.is_deleted = 0
+ and bu.`status` =1
+ and si.stats = 2
+ and si.departmentid = #{parentId}
+ and si.departmentid !=1432626178757275649
+ )
+ </if>
)c
</select>
<!--懒加载获取部门树形结构(包含用户数据)-->
+<!-- <select id="lazyTreeUser" resultMap="treeNodeResultMap">-->
+<!-- select DISTINCT * from (-->
+<!-- (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-->
+<!-- left join-->
+<!-- sys_information si-->
+<!-- on-->
+<!-- si.departmentid = dept.id-->
+<!-- WHERE-->
+<!-- dept.is_deleted = 0-->
+<!-- and si.stats = 2-->
+<!-- and (si.departmentid = 1442114073838800898-->
+<!-- or si.departmentid = 1442115701350387714)-->
+<!-- )-->
+
+<!-- union-->
+
+<!-- (select-->
+<!-- bu.id,-->
+<!-- bu.dept_id parent_id,-->
+<!-- real_name AS title,-->
+<!-- bu.id AS "value",-->
+<!-- bu.id AS "key",-->
+<!-- 0 as "has_children"-->
+<!-- from blade_user bu-->
+<!-- left join-->
+<!-- blade_dept bd-->
+<!-- on-->
+<!-- bd.id = bu.dept_id-->
+<!-- left join-->
+<!-- sys_information si-->
+<!-- on-->
+<!-- si.departmentid = bd.id-->
+<!-- where bd.is_deleted = 0-->
+<!-- and bu.is_deleted = 0-->
+<!-- and bu.`status` =1-->
+<!-- and si.stats = 2-->
+<!-- and (si.departmentid = 1442114073838800898-->
+<!-- or si.departmentid = 1442115701350387714)-->
+<!-- )-->
+<!-- )c-->
+<!-- </select>-->
+
+ <!--懒加载获取部门树形结构(包含用户数据)-->
<select id="lazyTreeUsers" resultType="org.springblade.modules.system.node.TreeNodes" >
select DISTINCT
*
--
Gitblit v1.9.3