<?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 <= date_add(curdate(), interval 1 month)
|
and (d.last_calibration_date is null or d.last_calibration_date < 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>
|