From 030cc847e46dcaa687f961785b458c6f9714ed49 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Tue, 10 Aug 2021 09:02:43 +0800
Subject: [PATCH] 问题修复

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |   63 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index 9f4dbea..60cc750 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -62,7 +62,7 @@
     </resultMap>
 
     <select id="selectUserPage" resultMap="userResultMap">
-        select *  from blade_user
+        select * from blade_user
         where is_deleted = 0
         <if test="tenantId!=null and tenantId != ''">
             and tenant_id = #{tenantId}
@@ -97,7 +97,7 @@
 
 
     <select id="selectUserPages" resultMap="userResultMaps">
-        select s.*,p.jd,p.wd,ST_ASTEXT ( e.coordinate )  from blade_user s
+        select s.*,p.jd,p.wd,ST_ASTEXT ( e.coordinate ) from blade_user s
         LEFT JOIN sys_position p ON p.snumber = s.CODE
         LEFT JOIN sys_enclosure e ON e.anumber = s.CODE
         left join
@@ -137,7 +137,7 @@
     </select>
 
     <select id="selectUserPagetxl" resultMap="userResultMaps">
-        select s.*,p.jd,p.wd,ST_ASTEXT ( e.coordinate )  from blade_user s
+        select s.*,p.jd,p.wd,ST_ASTEXT ( e.coordinate ) from blade_user s
         LEFT JOIN sys_position p ON p.snumber = s.CODE
         LEFT JOIN sys_enclosure e ON e.anumber = s.CODE
         left join
@@ -247,4 +247,61 @@
             where bu.region_id is not null
         group by bu.region_id
     </select>
+
+    <!-- 统计六大队伍数量 -->
+    <select id="getUserTypeCount" resultType="org.springblade.modules.system.vo.UserRegisterStatisVO">
+        SELECT
+            '治保会队伍' AS region,
+            count( * ) num
+        FROM
+            blade_user bu
+            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
+        WHERE
+            dept.id = '1424615693403414529'
+            UNION ALL
+            SELECT
+            '内保干部队伍' AS region,
+            count( * ) num
+        FROM
+            blade_user bu
+            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
+        WHERE
+            dept.id = '1424615773594312705'
+            UNION ALL
+            SELECT
+            '治安巡防队伍' AS region,
+            count( * ) num
+        FROM
+            blade_user bu
+            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
+        WHERE
+            dept.id = '1424615835435130881'
+            UNION ALL
+            SELECT
+            '信息员队伍' AS region,
+            count( * ) num
+        FROM
+            blade_user bu
+            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
+        WHERE
+            dept.id = '1424615909959524354'
+            UNION ALL
+            SELECT
+            '保安员队伍' AS region,
+            count( * ) num
+        FROM
+            blade_user bu
+            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
+        WHERE
+            dept.id = '1424615972718895106'
+            UNION ALL
+            SELECT
+            '警务辅助队伍' AS region,
+            count( * ) num
+        FROM
+            blade_user bu
+            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
+        WHERE
+            dept.id = '1424616047083905026'
+    </select>
 </mapper>

--
Gitblit v1.9.3