质量bug修复

This commit is contained in:
guoshengxiong 2024-05-13 21:08:25 +08:00
parent 3eff952ad6
commit d271c5c370

View File

@ -130,6 +130,16 @@
</if> </if>
</sql> </sql>
<sql id="selectShow">
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 &lt; now() THEN 1 ELSE 0 END)), 0)
as overTimeRectifiedNum,
IFNULL(SUM((CASE WHEN t.status = 2 and t.change_limit_time &lt; now() THEN 1 ELSE 0 END)), 0)
as overTimeNotRectifiedNum,
</sql>
<sql id="selectTotal"> <sql id="selectTotal">
select tp.*, select tp.*,
round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 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) round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
rectifiedNumRatioTimely rectifiedNumRatioTimely
from (SELECT count(*) totalNum, from (SELECT count(*) totalNum,
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum, <include refid="selectShow">
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) </include>
rectifiedNumTimely,
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time &lt; now() THEN 1 ELSE 0 END)), 0)
overTimeRectifiedNum,
IFNULL(SUM((CASE WHEN t.status = 2 and change_limit_time &lt; now() THEN 1 ELSE 0 END)), 0)
overTimeNotRectifiedNum,
su.real_name as workerName su.real_name as workerName
from quality_inspection_record t from quality_inspection_record t
left join system_user su on su.user_id = t.change_id left join system_user su on su.user_id = t.change_id
@ -610,24 +615,23 @@
rectifiedNumRatioTimely rectifiedNumRatioTimely
from (SELECT count(*) totalNum, from (SELECT count(*) totalNum,
count(*) createDangerNum, count(*) createDangerNum,
IFNULL(SUM((CASE WHEN hdir.status != 2 THEN 1 ELSE 0 END)), 0) rectifiedNum, <include refid="selectShow">
IFNULL(SUM((CASE WHEN hdir.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) </include>
rectifiedNumTimely,
su.real_name as workerName su.real_name as workerName
from quality_inspection_record hdir from quality_inspection_record t
left join system_user su on su.user_id = hdir.inspect_man_id left join system_user su on su.user_id = t.inspect_man_id
WHERE record_type = 1 WHERE record_type = 1
and hdir.status != 6 and t.status != 6
and project_sn = #{param.projectSn} and project_sn = #{param.projectSn}
<if test="param.inspectTime_begin != null and param.inspectTime_begin != ''"> <if test="param.inspectTime_begin != null and param.inspectTime_begin != ''">
and hdir.inspect_time <![CDATA[>=]]> #{param.inspectTime_begin} and t.inspect_time <![CDATA[>=]]> #{param.inspectTime_begin}
</if> </if>
<if test="param.inspectTime_end != null and param.inspectTime_end != ''"> <if test="param.inspectTime_end != null and param.inspectTime_end != ''">
and hdir.inspect_time <![CDATA[<=]]> if(LENGTH(#{param.inspectTime_end}) = 10, and t.inspect_time <![CDATA[<=]]> if(LENGTH(#{param.inspectTime_end}) = 10,
CONCAT(DATE_FORMAT(#{param.inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'), CONCAT(DATE_FORMAT(#{param.inspectTime_end}, '%Y-%m-%d'), ' 23:59:59'),
#{param.inspectTime_end}) #{param.inspectTime_end})
</if> </if>
group by hdir.inspect_man_id group by t.inspect_man_id
order by rectifiedNum desc) t order by rectifiedNum desc) t
</select> </select>
@ -638,9 +642,8 @@
round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2) round(IFNULL(TRUNCATE(IFNULL(t.rectifiedNumTimely, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2)
rectifiedNumRatioTimely rectifiedNumRatioTimely
from (SELECT count(*) as totalNum, from (SELECT count(*) as totalNum,
IFNULL(SUM((CASE WHEN t.status != 2 THEN 1 ELSE 0 END)), 0) as rectifiedNum, <include refid="selectShow">
IFNULL(SUM((CASE WHEN t.status != 2 and change_limit_time > now() THEN 1 ELSE 0 END)), 0) as </include>
rectifiedNumTimely,
ei.enterprise_name ei.enterprise_name
from quality_inspection_record t from quality_inspection_record t
left join enterprise_info ei on ei.id = t.enterprise_id left join enterprise_info ei on ei.id = t.enterprise_id