龚焕茏
2024-08-20 e64cf23c812a1a27cefe0c763d447323261b0c89
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>