<select id="getWorkOrderPageList" resultType="cn.com.gdt.ciems.om.biz.backend.workorder.model.WorkOrderPageDto">
SELECT
t.*,
tfr.faultLevelName,
tfr.fault_description,
tfr.fault_location,
tfr.repair_time,
tmp.maintain_name,
tmp.device_name,
tmp.start_time,
tmp.maintain_cycle,
a.`name` orderTypeName,
b.`name` statusName,
tro.receiver,
tro.receiverphone
FROM
`t_om_workorder` t
LEFT JOIN (
SELECT
tf.*,
ta.`name` faultLevelName
FROM
t_om_fault_record tf
LEFT JOIN t_om_common_code ta ON tf.fault_level = ta.`value`
WHERE
ta.classification = 200
) tfr ON t.source_id = tfr.id
LEFT JOIN t_om_maintenance_plan tmp ON t.source_id = tmp.id and tmp.flag is not null and tmp.flag != 1
LEFT JOIN t_om_common_code a ON t.order_type = a.`value`
LEFT JOIN t_om_common_code b ON t.`status` = b.`value`
left join t_om_receive_order tro on t.id = tro.work_order_id
<where>
<if test="map.orderType != null">
t.order_type = #{map.orderType}
</if>
<if test="map.status != null">
and t.status = #{map.status}
</if>
<if test="map.doneTime != null">
<![CDATA[ and DATE_FORMAT(t.done_time , '%Y-%m-%d')= DATE_FORMAT(#{map.doneTime}, '%Y-%m-%d') ]]>
</if>
<if test="map.workOrderNo != null">
and t.work_order_no like '%${map.workOrderNo}%'
</if>
</where>
GROUP BY t.id
</select>
注意红色的部分,必须要有
<![CDATA[ ]]>
<select id="shouldOverListByDate" resultType="cn.com.gdt.ciems.om.biz.backend.maintenance.entity.MaintenancePlan">
SELECT t.* FROM t_om_maintenance_plan t WHERE #{date} <![CDATA[ >= ]]> t.end_time and t.plan_status='3';
</select>