fix(qms-pdi): 修复不合格检测项查询逻辑
- 修改固定条件逻辑为已完成/待流转且总体不合格或存在不合格检测项 - 将inspection_inspection判断调整为false或存在不合格检测项时生效 - 优化子查询条件,保证满足任一不合格情况均被选中 - 修正XML语法,使条件表达更准确明确
This commit is contained in:
parent
f3fbc2cc47
commit
e639e633e0
|
|
@ -105,15 +105,17 @@
|
||||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||||
LEFT JOIN qms_issue_ticket it ON it.source_type = 1 AND it.source_id = t.id
|
LEFT JOIN qms_issue_ticket it ON it.source_type = 1 AND it.source_id = t.id
|
||||||
<where>
|
<where>
|
||||||
<!-- 固定条件:已完成/待流转 + 不合格 + 存在不合格检测项 -->
|
<!-- 固定条件:已完成/待流转,且(总体不合格 或 存在不合格检测项) -->
|
||||||
AND t.inspection_enable IN (2, 3)
|
AND t.inspection_enable IN (2, 3)
|
||||||
AND t.inspection_inspection = false
|
AND (
|
||||||
AND EXISTS (
|
t.inspection_inspection = false
|
||||||
|
OR EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM qms_pdi_inspection_results ir
|
FROM qms_pdi_inspection_results ir
|
||||||
WHERE ir.task_id = t.id
|
WHERE ir.task_id = t.id
|
||||||
AND ir.inspection_item_results = false
|
AND ir.inspection_item_results = false
|
||||||
)
|
)
|
||||||
|
)
|
||||||
<if test="request.inspectionType != null">
|
<if test="request.inspectionType != null">
|
||||||
AND r.inspection_type = #{request.inspectionType}
|
AND r.inspection_type = #{request.inspectionType}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue