From cb7d99d810f2356096b67fbccd3fac556e638d83 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期四, 22 八月 2024 11:22:56 +0800
Subject: [PATCH] feat:查询条件优化
---
ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
index a3c9adf..85e8d77 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CalculateReportMapper.xml
@@ -102,12 +102,13 @@
<select id="exportData" resultType="com.ycl.platform.domain.excel.CalculateExport">
SELECT
- SUBSTRING_INDEX(rule_name, '/', 1) AS rule_name,
- COUNT(*) AS num,
- -SUM(score) AS score
- FROM t_contract_score
- WHERE contract_id = #{contractId} AND auditing_status = 'PASS' AND deleted = 0
- GROUP BY SUBSTRING_INDEX(rule_name, '/', 1)
+ a.rule_name,
+ COUNT(b.id) AS num,
+ IFNULL(-SUM(score), 0) AS score
+ FROM t_calculate_rule a
+ LEFT JOIN t_contract_score b ON b.rule_id = a.id AND auditing_status = 'PASS' AND b.deleted = 0
+ WHERE a.contract_id = #{contractId} AND a.deleted = 0
+ GROUP BY a.rule_name
</select>
</mapper>
--
Gitblit v1.8.0