<?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="org.jeecg.modules.eam.mapper.EamReportRepairMapper">
|
|
<select id="pageList" resultType="org.jeecg.modules.eam.entity.EamReportRepair">
|
SELECT
|
t1.*,
|
t2.equipment_name
|
FROM
|
eam_report_repair t1
|
LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
|
<where>
|
<choose>
|
<when test="equipmentIds != null and equipmentIds.size() > 0 ">
|
AND t2.equipment_code IN
|
<foreach collection="equipmentIds" item="equipmentId" index="index" open="(" close=")" separator=",">
|
{equipmentId}
|
</foreach>
|
</when>
|
<otherwise>
|
EXISTS ( SELECT 1 FROM mdc_user_production t3 WHERE t3.user_id = #{userId} AND t3.pro_id= t2.org_id )
|
</otherwise>
|
</choose>
|
<if test="eamReportRepair.equipmentId != null and eamReportRepair.equipmentId != ''">
|
AND t2.equipment_code LIKE CONCAT(CONCAT('%',#{ eamReportRepair.equipmentId }),'%')
|
</if>
|
<if test="eamReportRepair.equipmentName != null and eamReportRepair.equipmentName != ''">
|
AND t2.equipment_name = LIKE CONCAT(CONCAT('%',#{ eamReportRepair.equipmentName }),'%')
|
</if>
|
<if test="eamReportRepair.breakdownFlag != null and eamReportRepair.breakdownFlag != ''">
|
AND t1.breakdown_flag = #{ eamReportRepair.breakdownFlag }
|
</if>
|
<if test="eamReportRepair.faultType != null and eamReportRepair.faultType != ''">
|
AND t1.fault_type = #{ eamReportRepair.faultType }
|
</if>
|
<if test="eamReportRepair.reportStatus != null and eamReportRepair.reportStatus != ''">
|
AND t1.report_status = #{ eamReportRepair.reportStatus }
|
</if>
|
<if test="eamReportRepair.faultName != null and eamReportRepair.faultName != ''">
|
AND t1.fault_name = #{ eamReportRepair.faultName }
|
</if>
|
<if test="eamReportRepair.startTime != null and eamReportRepair.startTime != '' and eamReportRepair.endTime != null and eamReportRepair.endTime != ''">
|
AND t1.fault_start_time BETWEEN #{ eamReportRepair.startTime } AND #{ eamReportRepair.endTime }
|
</if>
|
</where>
|
ORDER BY t1.fault_start_time DESC
|
</select>
|
</mapper>
|