From 09a73af712366265c9b7d200e1dac2fa83c82b9a Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 15 Sep 2021 09:12:53 +0800
Subject: [PATCH] 1.接口调整

---
 src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 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 56918a8..7044787 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -386,9 +386,9 @@
             IFNULL(B.cz,0) as cz,
             IFNULL(C.wcz,0) as wcz
         FROM (SELECT jurisdiction FROM blade_user ) A
-            LEFT JOIN (SELECT COUNT(hold) as cz,jurisdiction FROM blade_user WHERE hold=0 GROUP BY jurisdiction ) B ON A.jurisdiction=B.jurisdiction
-            LEFT JOIN (SELECT COUNT(hold) as wcz,jurisdiction FROM blade_user WHERE hold=1 GROUP BY jurisdiction ) C ON A.jurisdiction=C.jurisdiction
-        WHERE A.jurisdiction=#{deptid} GROUP BY cz,wcz
+            LEFT JOIN (SELECT COUNT(hold) as cz,jurisdiction FROM blade_user WHERE hold=0 and status=1 GROUP BY jurisdiction ) B ON A.jurisdiction=B.jurisdiction
+            LEFT JOIN (SELECT COUNT(hold) as wcz,jurisdiction FROM blade_user WHERE hold=1 and status=1 GROUP BY jurisdiction ) C ON A.jurisdiction=C.jurisdiction
+        WHERE A.jurisdiction in(${deptid}) GROUP BY cz,wcz
     </select>
 
     <!--查询部门下面的所有单位-->
@@ -397,6 +397,7 @@
     </select>
     <select id="securityLazyTree" resultMap="treeNodeResultMap">
         SELECT
+        DISTINCT
         dept.id,
         dept.parent_id,
         dept.dept_name AS title,
@@ -412,12 +413,18 @@
         ) AS "has_children"
         FROM
         blade_dept dept
+        left join
+        sys_information si
+        on
+        si.departmentid = dept.id
         WHERE
-        dept.parent_id = #{param2} AND dept.is_deleted = 0
+        1=1
         and dept_category = 1
-        <if test="param1!=null and param1!=''">
-            and dept.tenant_id = #{param1}
+        AND dept.is_deleted = 0
+        and dept.id !=1420222961377357825
+        and dept.parent_id!=1420222961377357825
+        <if test="param1!=null and param1!='' and param1!='1123598813738675201'">
+            and si.jurisdiction = #{param1}
         </if>
-        ORDER BY dept.sort
     </select>
 </mapper>

--
Gitblit v1.9.3