瀏覽代碼

Merge remote-tracking branch 'origin/test-merge' into test-merge

cr 1 天之前
父節點
當前提交
4863326493

+ 16 - 22
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -515,28 +515,22 @@
         WHERE uaa.project_id = #{projectId} and uaa.is_deleted = 0
     </select>
     <select id="getAllArchiveFileByContractTypeSummary" resultType="java.util.Map">
-        select sum(a.key1 + a.key11) key1,sum(a.key2 + a.key12) key2,sum(a.key3 +a.key13) key3 ,a.key4,a.key5,a.key6 from (
-          SELECT
-              sum(uaf.source_type = 1 and matc.tree_code is null) key4,
-              sum((uaf.source_type != 1 or uaf.source_type is null ) and matc.tree_code is null) key3,
-              sum(uaf.source_type = 1 and matc.tree_code = 'S') key5,
-              sum((uaf.source_type != 1 or uaf.source_type is null ) and matc.tree_code = 'S') key2,
-              sum(uaf.source_type = 1 and matc.tree_code = 'C') key6,
-              sum((uaf.source_type != 1 or uaf.source_type is null ) and matc.tree_code = 'C') key1,
-              sum(mci.id is not null and mci.contract_type = 1) key11,
-              sum(mci.id is not null and mci.contract_type = 2) key12,
-              sum(mci.id is not null and mci.contract_type not in(1,2)) key13
-
-          FROM
-              u_archive_file uaf
-                  LEFT JOIN m_archive_tree_contract matc ON uaf.node_id = matc.id
-                  left join m_contract_info mci on matc.tree_code = mci.id and mci.is_deleted = 0
-          WHERE
-              uaf.project_id = #{projectId}
-            AND matc.is_deleted = 0
-            AND uaf.is_deleted = 0
-            AND ( uaf.is_auto_file IS NULL OR uaf.is_auto_file != 1 )
-      ) a
+        SELECT
+            sum(uaf.source_type = 1 and ((matc.tree_code is null or matc.tree_code = 'null') or (mci.id is not null and mci.contract_type not in(1,2)))) key4,
+            sum((uaf.source_type != 1 or uaf.source_type is null ) and ((matc.tree_code is null or matc.tree_code = 'null') or (mci.id is not null and mci.contract_type not in(1,2))) ) key3,
+            sum(uaf.source_type = 1 and (matc.tree_code = 'S' or (mci.id is not null and mci.contract_type = 2))) key5,
+            sum((uaf.source_type != 1 or uaf.source_type is null ) and (matc.tree_code = 'S' or (mci.id is not null and mci.contract_type = 2)) ) key2,
+            sum(uaf.source_type = 1 and (matc.tree_code = 'C' or (mci.id is not null and mci.contract_type = 1)) ) key6,
+            sum((uaf.source_type != 1 or uaf.source_type is null ) and (matc.tree_code = 'C' or (mci.id is not null and mci.contract_type = 1))) key1
+        FROM
+            u_archive_file uaf
+                LEFT JOIN m_archive_tree_contract matc ON uaf.node_id = matc.id
+                left join m_contract_info mci on matc.tree_code = mci.id and mci.is_deleted = 0
+        WHERE
+            uaf.project_id = #{projectId}
+          AND matc.is_deleted = 0
+          AND uaf.is_deleted = 0
+          AND ( uaf.is_auto_file IS NULL OR uaf.is_auto_file != 1 )
     </select>
     <select id="getAllArchiveFileByContractTypeCount" resultType="java.lang.Integer">
         SELECT count(0) `count`