|
|
|
|
@ -6,7 +6,7 @@ |
|
|
|
|
<select id="finishWorkList" resultType="map"> |
|
|
|
|
SELECT t.* |
|
|
|
|
from ( |
|
|
|
|
SELECT 1 as business_type, wo.id as business_id, wo.requirement_code as business_code, u.`name` as serviceman, IFNULL(wo.discount_price,0) as price |
|
|
|
|
SELECT 1 as business_type, wo.id as business_id, wo.requirement_code as business_code, u.`name` as serviceman, IFNULL(wo.total_cost,0) as price |
|
|
|
|
from lab_work_order wo |
|
|
|
|
left join blade_user u on wo.repair_person = u.id |
|
|
|
|
WHERE wo.is_deleted= 0 AND wo.`status` = 203 |
|
|
|
|
@ -17,7 +17,7 @@ from ( |
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
UNION ALL |
|
|
|
|
SELECT 2 as business_type, mt.id as business_id, mt.task_code as buseness_code, u.`name` as serviceman, COUNT(mtd.price) as price |
|
|
|
|
SELECT 2 as business_type, mt.id as business_id, mt.task_code as buseness_code, u.`name` as serviceman, IFNULL(mt.actual_amount,0) as price |
|
|
|
|
from lab_maintenance_task mt |
|
|
|
|
left join blade_user u on mt.serviceman_id = u.id |
|
|
|
|
left join lab_maintenance_task_detail mtd on mt.id = mtd.task_id |
|
|
|
|
@ -36,21 +36,33 @@ limit ${offset}, ${size} |
|
|
|
|
</select> |
|
|
|
|
<select id="finishWorkListCount" resultType="int"> |
|
|
|
|
SELECT count(1) |
|
|
|
|
from ( |
|
|
|
|
SELECT 1 as business_type, wo.id as business_id, wo.requirement_code as business_code, u.`name` as serviceman, IFNULL(wo.discount_price,0) as price |
|
|
|
|
from lab_work_order wo |
|
|
|
|
left join blade_user u on wo.repair_person = u.id |
|
|
|
|
WHERE wo.is_deleted= 0 AND wo.`status` = 8 |
|
|
|
|
UNION ALL |
|
|
|
|
SELECT 2 as business_type, mt.id as buseness_id, mt.task_code as buseness_code, u.`name` as serviceman, COUNT(mtd.price) as price |
|
|
|
|
from lab_maintenance_task mt |
|
|
|
|
left join blade_user u on mt.serviceman_id = u.id |
|
|
|
|
left join lab_maintenance_task_detail mtd on mt.id = mtd.task_id |
|
|
|
|
WHERE mt.is_deleted= 0 and mt.repair_status = 7 |
|
|
|
|
group by mt.id, mt.task_code |
|
|
|
|
) t |
|
|
|
|
left join lab_invoice_apply_detail d on t.business_id = d.business_id |
|
|
|
|
where d.id is NULL |
|
|
|
|
from ( |
|
|
|
|
SELECT 1 as business_type, wo.id as business_id, wo.requirement_code as business_code, u.`name` as serviceman, IFNULL(wo.total_cost,0) as price |
|
|
|
|
from lab_work_order wo |
|
|
|
|
left join blade_user u on wo.repair_person = u.id |
|
|
|
|
WHERE wo.is_deleted= 0 AND wo.`status` = 203 |
|
|
|
|
<if test="deptIds != null"> |
|
|
|
|
and wo.report_unit in |
|
|
|
|
<foreach collection="deptIds" item="deptId" index="index" open="(" close=")" separator=","> |
|
|
|
|
#{deptId} |
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
UNION ALL |
|
|
|
|
SELECT 2 as business_type, mt.id as business_id, mt.task_code as buseness_code, u.`name` as serviceman, mt.actual_amount as price |
|
|
|
|
from lab_maintenance_task mt |
|
|
|
|
left join blade_user u on mt.serviceman_id = u.id |
|
|
|
|
left join lab_maintenance_task_detail mtd on mt.id = mtd.task_id |
|
|
|
|
WHERE mt.is_deleted= 0 and mt.repair_status = 7 |
|
|
|
|
<if test="deptIds != null"> |
|
|
|
|
and mt.dept_id in |
|
|
|
|
<foreach collection="deptIds" item="deptId" index="index" open="(" close=")" separator=","> |
|
|
|
|
#{deptId} |
|
|
|
|
</foreach> |
|
|
|
|
</if> |
|
|
|
|
group by mt.id, mt.task_code |
|
|
|
|
) t |
|
|
|
|
left join lab_invoice_apply_detail d on t.business_id = d.business_id |
|
|
|
|
where d.id is NULL |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|