吴羡
5 小时以前 2f07589b54d56085af77b50d580890cd4130b444
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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.DeviceCalibrationPlanDetailMapper">
 
    <!-- 设备校准计划详情列表 -->
    <select id="pageDeviceCalibrationPlanDetail" resultType="com.ruoyi.device.dto.DeviceCalibrationPlanDetailDto">
        select * from (
        select t.*,
        case when d.next_calibration_date is not null
        and d.next_calibration_date &lt;= date_add(curdate(), interval 1 month)
        and (d.last_calibration_date is null or d.last_calibration_date &lt; t.plan_date)
        then 1 else 0 end as red_flag
        from device_calibration_plan_detail t
        left join device d on d.id = t.device_id
        order by t.plan_date asc
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
 
</mapper>