From d271c5c3708edad99dd7371cb16707a373f7a153 Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Mon, 13 May 2024 21:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8Fbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xml/QualityInspectionRecordMapper.xml | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml index f2d4a94f8..99318afa3 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml @@ -130,6 +130,16 @@ + + IFNULL(SUM((CASE WHEN t.status != 2 and t.change_limit_time > now() or t.status = 5 THEN 1 ELSE 0 END)), + 0) as rectifiedNumTimely, + IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) as rectifiedNum, + IFNULL(SUM((CASE WHEN t.status in (3, 4) and t.change_limit_time < now() THEN 1 ELSE 0 END)), 0) + as overTimeRectifiedNum, + IFNULL(SUM((CASE WHEN t.status = 2 and t.change_limit_time < now() THEN 1 ELSE 0 END)), 0) + as overTimeNotRectifiedNum, + + select tp.*, round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, @@ -572,13 +582,8 @@ round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2) rectifiedNumRatioTimely from (SELECT count(*) totalNum, - IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum, - IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) - rectifiedNumTimely, - IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time < now() THEN 1 ELSE 0 END)), 0) - overTimeRectifiedNum, - IFNULL(SUM((CASE WHEN t.status = 2 and change_limit_time < now() THEN 1 ELSE 0 END)), 0) - overTimeNotRectifiedNum, + + su.real_name as workerName from quality_inspection_record t left join system_user su on su.user_id = t.change_id @@ -610,24 +615,23 @@ rectifiedNumRatioTimely from (SELECT count(*) totalNum, count(*) createDangerNum, - IFNULL(SUM((CASE WHEN hdir.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum, - IFNULL(SUM((CASE WHEN hdir.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) - rectifiedNumTimely, + + su.real_name as workerName - from quality_inspection_record hdir - left join system_user su on su.user_id = hdir.inspect_man_id + from quality_inspection_record t + left join system_user su on su.user_id = t.inspect_man_id WHERE record_type = 1 - and hdir.status != 6 + and t.status != 6 and project_sn = #{param.projectSn} - and hdir.inspect_time =]]> #{param.inspectTime_begin} + and t.inspect_time =]]> #{param.inspectTime_begin} - and hdir.inspect_time if(LENGTH(#{param.inspectTime_end}) = 10, + and t.inspect_time if(LENGTH(#{param.inspectTime_end}) = 10, CONCAT(DATE_FORMAT(#{param.inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'), #{param.inspectTime_end}) - group by hdir.inspect_man_id + group by t.inspect_man_id order by rectifiedNum desc) t @@ -638,9 +642,8 @@ round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2) rectifiedNumRatioTimely from (SELECT count(*) as totalNum, - IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) as rectifiedNum, - IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) as - rectifiedNumTimely, + + ei.enterprise_name from quality_inspection_record t left join enterprise_info ei on ei.id = t.enterprise_id