From bf0ba48d2531d6550d0ededb9ef1b3c0d31b535f Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 17 Sep 2021 09:35:33 +0800
Subject: [PATCH] 1.首页统计

---
 src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml |   25 ++++++++++++++++++-------
 1 files changed, 18 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 1fea3ec..d5cb1f4 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -382,13 +382,24 @@
     </select>
 
     <select id="selectHold" resultType="java.util.HashMap">
-        SELECT
-            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 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 IFNULL(B.cz, 0)  as cz,
+               IFNULL(C.wcz, 0) as wcz,
+               A.jurisdiction
+        FROM (SELECT jurisdiction FROM blade_user) A
+                 LEFT JOIN (SELECT COUNT(hold) as cz, jurisdiction
+                            FROM blade_user
+                            WHERE hold = 1
+                              AND role_id = '1412226235153731586'
+                              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 = 2
+                              AND role_id = '1412226235153731586'
+                              and status = 1
+                            GROUP BY jurisdiction) C ON A.jurisdiction = C.jurisdiction
+        WHERE A.jurisdiction in (${deptid})
+        GROUP BY cz, wcz, jurisdiction
     </select>
 
     <!--查询部门下面的所有单位-->

--
Gitblit v1.9.3