bug修复

This commit is contained in:
mashuai 2025-05-20 16:08:48 +08:00
parent b48fe4c069
commit cc4a73b0de
1 changed files with 14 additions and 8 deletions

View File

@ -215,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(
SELECT
lod.ma_id AS maId,
mt.type_id,
mt.type_id AS typeId,
SUM(IFNULL(lod.out_num, 0)) AS outNum,
bpl.lot_name proName
FROM
@ -228,28 +228,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
mt.type_id = #{typeId}
GROUP BY
lod.ma_id, mt.type_id
lod.ma_id, mt.type_id, bpl.lot_name
) AS subquery1
LEFT JOIN
(
SELECT
bcd.ma_id AS maId,
mt.type_id,
SUM(IFNULL(bcd.back_num, 0)) AS backNum
mt.type_id AS typeId,
SUM(IFNULL(bcd.back_num, 0)) AS backNum,
bpl.lot_name proName
FROM
back_check_details bcd
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN back_apply_info ba ON bcd.parent_id = ba.id
LEFT JOIN tm_task_agreement tta on ba.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id
WHERE
mt.type_id = #{typeId}
GROUP BY
bcd.ma_id, mt.type_id
bcd.ma_id, mt.type_id,bpl.lot_name
) AS subquery2 ON subquery1.maId = subquery2.maId
LEFT JOIN ma_type mt ON mt.type_id = subquery1.type_id
AND subquery1.typeId = subquery2.typeId
AND subquery1.proName = subquery2.proName
LEFT JOIN ma_type mt ON mt.type_id = subquery1.typeId
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = subquery1.maId
WHERE
mt.manage_type = 0
AND mt.del_flag = 0
mt.del_flag = 0
AND IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0
</select>
<select id="getzk" resultType="java.lang.Integer">