2025-03-20 16:11:17 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper">
|
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
SELECT
|
|
|
|
|
mm.ma_id as maId,
|
|
|
|
|
mm.next_check_time as nextCheckTime,
|
|
|
|
|
mt2.type_name as typeName,
|
|
|
|
|
mt.type_name as typeModelName,
|
|
|
|
|
mm.ma_code as maCode,
|
|
|
|
|
bu.unit_name as unitName,
|
|
|
|
|
bp.pro_name as projectName,
|
|
|
|
|
bai.agreement_code as agreementCode,
|
2025-07-31 18:25:38 +08:00
|
|
|
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays
|
2025-03-20 16:11:17 +08:00
|
|
|
FROM
|
|
|
|
|
ma_machine mm
|
|
|
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
|
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
|
|
|
LEFT JOIN slt_agreement_info sai on sai.ma_id=mm.ma_id and mm.type_id=sai.type_id and sai.`status`='0' and
|
|
|
|
|
sai.end_time is null
|
|
|
|
|
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sai.agreement_id
|
|
|
|
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
|
|
|
|
AND bu.del_flag = '0'
|
|
|
|
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
|
|
|
|
AND bp.del_flag = '0'
|
|
|
|
|
WHERE
|
|
|
|
|
mm.ma_status='2'
|
|
|
|
|
and bp.pro_name is not null
|
2025-07-31 18:25:38 +08:00
|
|
|
AND mm.next_check_time BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 1 MONTH)
|
2025-03-20 16:11:17 +08:00
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
and (mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mt.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mm.ma_code like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bu.unit_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bp.pro_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bai.agreement_code like concat('%', #{keyWord}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
AND DATE_FORMAT( mm.next_check_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
|
|
|
</if>
|
2025-07-31 18:25:38 +08:00
|
|
|
<if test="typeId != null">
|
|
|
|
|
AND mt.type_id = #{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="thirdTypeId != null">
|
|
|
|
|
AND mt2.type_id = #{thirdTypeId}
|
|
|
|
|
</if>
|
2025-03-20 16:11:17 +08:00
|
|
|
ORDER BY mm.next_check_time ASC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|