parent
72d67f1b66
commit
1969c65c6c
|
|
@ -715,8 +715,8 @@
|
||||||
bad.audit_num as preNum,
|
bad.audit_num as preNum,
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
bad.back_status as backStatus,
|
bad.back_status as backStatus,
|
||||||
COALESCE(sai0.num, 0) as num,
|
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
||||||
COALESCE(sai1.num, 0) as finished_back_num,
|
bb.finished_back_num,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
mt.company_id as companyId,
|
mt.company_id as companyId,
|
||||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
||||||
|
|
@ -724,12 +724,28 @@
|
||||||
back_apply_details bad
|
back_apply_details bad
|
||||||
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
|
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
|
||||||
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
||||||
LEFT JOIN (select agreement_id, sum(COALESCE(num, 0)) as num from slt_agreement_info where status=0
|
|
||||||
group by agreement_id) sai0 on tta.agreement_id=sai0.agreement_id
|
|
||||||
LEFT JOIN (select agreement_id, sum(COALESCE(num, 0)) as num from slt_agreement_info where status=1
|
|
||||||
group by agreement_id) sai1 on tta.agreement_id=sai1.agreement_id
|
|
||||||
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
type_id as typeId,
|
||||||
|
SUM(IFNULL(back_num,0)) as back_num
|
||||||
|
FROM
|
||||||
|
back_check_details
|
||||||
|
WHERE
|
||||||
|
parent_id=#{id}
|
||||||
|
GROUP BY type_id
|
||||||
|
) aa on aa.typeId=bad.type_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
type_id as typeId,
|
||||||
|
SUM(IFNULL(back_num,0)) as finished_back_num
|
||||||
|
FROM
|
||||||
|
back_check_details
|
||||||
|
WHERE
|
||||||
|
parent_id=#{id} and is_finished = 1
|
||||||
|
GROUP BY type_id
|
||||||
|
) bb on bb.typeId=bad.type_id
|
||||||
WHERE
|
WHERE
|
||||||
bai.id=#{id}
|
bai.id=#{id}
|
||||||
<if test="typeId != null and typeId != ''">
|
<if test="typeId != null and typeId != ''">
|
||||||
|
|
@ -1114,17 +1130,25 @@
|
||||||
bad.audit_num as preNum,
|
bad.audit_num as preNum,
|
||||||
bad.status as status,
|
bad.status as status,
|
||||||
bad.back_status as backStatus,
|
bad.back_status as backStatus,
|
||||||
COALESCE(sai.num, 0) as num,
|
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
|
||||||
mt.manage_type as manageType,
|
mt.manage_type as manageType,
|
||||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
||||||
FROM
|
FROM
|
||||||
back_apply_details bad
|
back_apply_details bad
|
||||||
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
|
LEFT JOIN back_apply_info bai on bai.id=bad.parent_id
|
||||||
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
||||||
LEFT JOIN (select agreement_id, sum(COALESCE(num, 0)) as num from slt_agreement_info where status=0
|
|
||||||
group by agreement_id) sai on tta.agreement_id=sai.agreement_id
|
|
||||||
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
type_id as typeId,
|
||||||
|
SUM(IFNULL(back_num,0)) as back_num
|
||||||
|
FROM
|
||||||
|
back_check_details
|
||||||
|
WHERE
|
||||||
|
parent_id=#{id}
|
||||||
|
GROUP BY type_id
|
||||||
|
) aa on aa.typeId=bad.type_id
|
||||||
WHERE
|
WHERE
|
||||||
bai.id=#{id}
|
bai.id=#{id}
|
||||||
order by bad.create_time
|
order by bad.create_time
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue