<iftest="date != null and date != ''"> and date = #{date}</if>
<!-- 日期查询:优先使用日期范围,如果没有范围则使用精确日期 -->
<choose>
<whentest="params != null and ((params.beginDate != null and params.beginDate != '') or (params.endDate != null and params.endDate != ''))">
<!-- 日期范围查询 -->
<iftest="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''">
and STR_TO_DATE(date, '%Y/%m/%d') BETWEEN STR_TO_DATE(#{params.beginDate}, '%Y/%m/%d') AND STR_TO_DATE(#{params.endDate}, '%Y/%m/%d')
</if>
<iftest="params.beginDate != null and params.beginDate != '' and (params.endDate == null or params.endDate == '')">
and STR_TO_DATE(date, '%Y/%m/%d') >= STR_TO_DATE(#{params.beginDate}, '%Y/%m/%d')
</if>
<iftest="params.endDate != null and params.endDate != '' and (params.beginDate == null or params.beginDate == '')">
and STR_TO_DATE(date, '%Y/%m/%d') <= STR_TO_DATE(#{params.endDate}, '%Y/%m/%d')
</if>
</when>
<otherwise>
<!-- 精确日期查询 -->
<iftest="date != null and date != ''">
and date = #{date}
</if>
</otherwise>
</choose>
<iftest="location != null and location != ''"> and location like concat('%', #{location}, '%')</if>
<iftest="dailyDutySupervisor != null and dailyDutySupervisor != ''"> and daily_duty_supervisor like concat('%', #{dailyDutySupervisor}, '%')</if>
<iftest="tendaDailyDutySupervisor != null and tendaDailyDutySupervisor != ''"> and tenda_daily_duty_supervisor like concat('%', #{tendaDailyDutySupervisor}, '%')</if>
@ -38,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="handlingDuration != null "> and handling_duration like concat('%', #{handlingDuration}, '%')</if>
<iftest="remarks != null and remarks != ''"> and remarks like concat('%', #{remarks}, '%')</if>
</where>
order by STR_TO_DATE(date, '%Y/%m/%d') desc, id desc
<iftest="faultDate != null and faultDate != ''"> and fault_date like concat('%', #{faultDate}, '%')</if>
<!-- 日期查询:优先使用日期范围,如果没有范围则使用精确日期 -->
<choose>
<whentest="params != null and ((params.beginDate != null and params.beginDate != '') or (params.endDate != null and params.endDate != ''))">
<!-- 日期范围查询 -->
<iftest="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''">
and STR_TO_DATE(fault_date, '%Y/%m/%d') BETWEEN STR_TO_DATE(#{params.beginDate}, '%Y/%m/%d') AND STR_TO_DATE(#{params.endDate}, '%Y/%m/%d')
</if>
<iftest="params.beginDate != null and params.beginDate != '' and (params.endDate == null or params.endDate == '')">
and STR_TO_DATE(fault_date, '%Y/%m/%d') >= STR_TO_DATE(#{params.beginDate}, '%Y/%m/%d')
</if>
<iftest="params.endDate != null and params.endDate != '' and (params.beginDate == null or params.beginDate == '')">
and STR_TO_DATE(fault_date, '%Y/%m/%d') <= STR_TO_DATE(#{params.endDate}, '%Y/%m/%d')
</if>
</when>
<otherwise>
<!-- 精确日期查询 -->
<iftest="faultDate != null and faultDate != ''">
and fault_date = #{faultDate}
</if>
</otherwise>
</choose>
<iftest="faultLocation != null and faultLocation != ''"> and fault_location like concat('%', #{faultLocation}, '%')</if>
<iftest="handlingPersonnel != null and handlingPersonnel != ''"> and handling_personnel like concat('%', #{handlingPersonnel}, '%')</if>
<iftest="faultPhenomenonAndCause != null and faultPhenomenonAndCause != ''"> and fault_phenomenon_and_cause like concat('%', #{faultPhenomenonAndCause}, '%')</if>
@ -36,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="mainComponentsRepaired != null and mainComponentsRepaired != ''"> and main_components_repaired like concat('%', #{mainComponentsRepaired}, '%')</if>
<iftest="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
order by STR_TO_DATE(fault_date, '%Y/%m/%d') desc, id desc
<iftest="date != null and date != ''"> and date like concat('%', #{date}, '%')</if>
<!-- 日期查询:优先使用日期范围,如果没有范围则使用精确日期 -->
<choose>
<whentest="params != null and ((params.beginDate != null and params.beginDate != '') or (params.endDate != null and params.endDate != ''))">
<!-- 日期范围查询 -->
<iftest="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''">
and STR_TO_DATE(date, '%Y/%m/%d') BETWEEN STR_TO_DATE(#{params.beginDate}, '%Y/%m/%d') AND STR_TO_DATE(#{params.endDate}, '%Y/%m/%d')
</if>
<iftest="params.beginDate != null and params.beginDate != '' and (params.endDate == null or params.endDate == '')">
and STR_TO_DATE(date, '%Y/%m/%d') >= STR_TO_DATE(#{params.beginDate}, '%Y/%m/%d')
</if>
<iftest="params.endDate != null and params.endDate != '' and (params.beginDate == null or params.beginDate == '')">
and STR_TO_DATE(date, '%Y/%m/%d') <= STR_TO_DATE(#{params.endDate}, '%Y/%m/%d')
</if>
</when>
<otherwise>
<!-- 精确日期查询 -->
<iftest="date != null and date != ''">
and date = #{date}
</if>
</otherwise>
</choose>
<iftest="jobCategory != null and jobCategory != ''"> and job_category like concat('%', #{jobCategory}, '%')</if>
<iftest="jobUnit != null and jobUnit != ''"> and job_unit like concat('%', #{jobUnit}, '%')</if>
<iftest="jobName != null and jobName != ''"> and job_name like concat('%', #{jobName}, '%')</if>
@ -48,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="isWorkOrderClosedLoop != null and isWorkOrderClosedLoop != ''"> and is_work_order_closed_loop like concat('%', #{isWorkOrderClosedLoop}, '%')</if>
<iftest="remarks != null and remarks != ''"> and remarks like concat('%', #{remarks}, '%')</if>
</where>
order by STR_TO_DATE(date, '%Y/%m/%d') desc, id desc