Browse Source

档案系统-案卷统计-已组案卷统计调整

LHB 1 month ago
parent
commit
1961daf5af

+ 17 - 16
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -1402,22 +1402,23 @@
     </select>
     <select id="getAllArchiveByContractTypeSummary" resultType="java.util.Map">
         select sum(a.key1 + a.key11) key1,sum(a.key2 + a.key12) key2,sum(a.key3 +a.key13) key3  from (
-         SELECT
-             sum( matc.tree_code IS NULL ) key3,
-             sum( matc.tree_code = 'S' ) key2,
-             sum( matc.tree_code = 'C' ) key1,
-             sum( mci.contract_type = 1 ) key11,
-             sum( mci.contract_type = 2 ) key12,
-             sum( mci.contract_type NOT IN ( 1, 2 )) key13
-         FROM
-             m_archive_tree_contract matc
-                 LEFT JOIN u_archives_auto uaa ON uaa.node_id = matc.id
-                 LEFT JOIN m_contract_info mci ON matc.tree_code = mci.id  and mci.is_deleted = 0
-         WHERE
-             uaa.project_id = #{projectId}
-           AND uaa.is_deleted = #{type}
-           AND uaa.is_destroy = #{type}
-        )a
+             SELECT
+                 IFNULL(sum( matc.tree_code IS NULL ),0) key3,
+                 IFNULL(sum( matc.tree_code = 'S' ),0) key2,
+                 IFNULL(sum( matc.tree_code = 'C' ),0) key1,
+                 IFNULL(sum( mci.contract_type = 1 ),0) key11,
+                 IFNULL(sum( mci.contract_type = 2 ),0) key12,
+                 IFNULL(sum( mci.contract_type NOT IN ( 1, 2 )),0) key13
+             FROM
+                 u_archives_auto uaa
+                     inner JOIN m_archive_tree_contract matc ON uaa.node_id = matc.id and matc.is_deleted = 0
+                     LEFT JOIN m_contract_info mci ON matc.tree_code = mci.id  and mci.is_deleted = 0
+             WHERE
+                 uaa.project_id = #{projectId}
+               AND uaa.is_deleted = #{type}
+               AND uaa.is_destroy = #{type}
+               AND uaa.is_archive = 1
+         )a
     </select>
     <select id="selectAllArchiveAuto" resultType="org.springblade.archive.vo.ArchivesAutoVO4">
         select uaa.id ,uaa.file_number,uaa.node_id,uatc.parent_Id,uatc.file_number_prefix from u_archives_auto uaa left join m_archive_tree_contract uatc on uaa.node_id=uatc.id where uaa.is_deleted = 0 and uaa.project_id=#{projectId}