增加查询未完成维修单列表功能,优化相关SQL逻辑

This commit is contained in:
syruan 2025-09-27 10:21:08 +08:00
parent 535e9ccc2f
commit ba3470bc26
2 changed files with 24 additions and 21 deletions

View File

@ -307,5 +307,9 @@ public interface SltAgreementInfoMapper {
*/
List<PeriodCostResultVo> selectPeriodCostListForCharge(PeriodCostQueryDto queryDto);
/**
* 查询某个协议未完成的维修单列表
* @param bean 协议ID
*/
List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean);
}

View File

@ -1371,23 +1371,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tt.code as repairCode,
tt.task_type as taskType,
sdd.dict_label as repairStatus
from tm_task tt
from
tm_task tt
left join tm_task_agreement tta on tta.task_id = tt.task_id
left join sys_dict_data sdd on sdd.dict_value = tt.task_status and sdd.dict_type = 'repair_task_status'
where tta.agreement_id = #{agreementId} and tt.task_type = 4 and tt.task_status != 1
and tt.task_id not in ( select
where
tta.agreement_id = #{agreementId} and tt.task_type = 4 and tt.task_status != 1
and tt.task_id not in (
select
tt.task_id as taskId
from tm_task tt
left join tm_task_agreement tta on tta.task_id = tt.task_id
LEFT JOIN repair_apply_details rad on tt.task_id = rad.task_id and is_ds =1
where tta.agreement_id = #{agreementId} and tt.task_type = 4 and tt.task_status != 1
left join repair_apply_details rad on tt.task_id = rad.task_id and is_ds =1
where
tta.agreement_id = #{agreementId} and tt.task_type = 4 and tt.task_status != 1
AND IFNULL(rad.repaired_num,0) > 0
)
<if test="repairCode != null">
and tt.code like concat('%', #{repairCode}, '%')
</if>