吴羡
4 小时以前 2f07589b54d56085af77b50d580890cd4130b444
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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.ruoyi.device.mapper.DeviceMaintenancePlanDetailsMapper">
 
 
    <select id="deviceInspectionRecordDetailsList"
            resultType="com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto">
        select
            dmpd.*,
            d.device_name,
            d.management_number device_number,
            d.specification_model,
            d.management_number,
            d.storage_point
        from device_maintenance_plan_details dmpd
        left join device d on dmpd.device_id = d.id
        where dmpd.maintenance_plan_id = #{maintenancePlanId}
    </select>
 
    <!-- 设备保养计划详情列表(含到点标红) -->
    <select id="pageMaintenancePlanDetail" resultType="com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto">
        select
            dmpd.*,
            d.device_name,
            d.management_number device_number,
            d.specification_model,
            d.management_number,
            d.storage_point,
            case when d.next_maintenance_date is not null
                and d.next_maintenance_date &lt;= date_add(curdate(), interval 1 month)
                and (d.last_maintenance_date is null or d.last_maintenance_date &lt; dmpd.maintenance_date)
                then 1 else 0 end as red_flag
        from device_maintenance_plan_details dmpd
        left join device d on dmpd.device_id = d.id
        where dmpd.maintenance_plan_id = #{planId}
        <if test="deviceName != null and deviceName != ''">
            and d.device_name like concat('%', #{deviceName}, '%')
        </if>
        <if test="deviceNumber != null and deviceNumber != ''">
            and d.management_number like concat('%', #{deviceNumber}, '%')
        </if>
        order by dmpd.maintenance_date asc
    </select>
 
</mapper>