Browse Source

修改安全保卫工作情况导出业务库数据

xujie 1 year ago
parent
commit
461f009d82

+ 21 - 12
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgMapper.xml

@@ -884,19 +884,28 @@ and
     </select>
     <select id="getLibrary" resultType="java.util.Map">
         SELECT
-            COUNT( a.business_library_type ) AS total,
-            IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
-            IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
-            IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
-            IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
+            sum( a.yywd + a.zxywk ) AS total,
+            a.one,
+            a.two,
+            a.three,
+            a.four
         FROM
-            sys_org_extend a
-                LEFT JOIN sys_org b ON a.org_id = b.id
-        where
-        1=1
-        and    b.path LIKE concat(#{orgPath}, '%')
-        and b.is_lock = 0
-        and b.deleted = 0
+            (
+                SELECT
+                    IFNULL( sum( IF ( b.type = 6, 1, 0 )), 0 ) AS yywd,
+                    IFNULL( sum( IF ( b.type = 4 AND a.business_library = 1, 1, 0 )), 0 ) AS zxywk,
+                    IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
+                    IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
+                    IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
+                    IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
+                FROM
+                    sys_org b
+                        LEFT JOIN sys_org_extend a ON a.org_id = b.id
+                WHERE
+                  b.is_lock = 0
+                  and b.path LIKE concat(#{orgPath}, '%')
+                  and b.deleted = 0
+            ) a
     </select>
     <select id="getCollectLibrary" resultType="java.lang.Integer">
         SELECT