<?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.njcn.process.mapper.SupvAlarmBackMapper">

    <select id="pageAlarmBack" resultType="com.njcn.process.pojo.po.SupvAlarmBack">
        select
            sab.*,
            sa.bill_No,
            sa.bill_Name
        from
            supv_alarm sa
        INNER JOIN supv_alarm_back sab on sab.work_Alarm_Id = sa.Alarm_Id
        <where>
            <if test="param.workAlarmId != null and param.workAlarmId != ''">
                AND sa.Alarm_Id = #{param.workAlarmId}
            </if>
            <if test="param.searchBeginTime != null and param.searchBeginTime != ''">
                AND DATE_FORMAT(sab.complete_Time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{param.searchBeginTime}, '%Y-%m-%d')
            </if>
            <if test="param.searchEndTime != null and param.searchEndTime != ''">
                AND DATE_FORMAT(sab.complete_Time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{param.searchEndTime}, '%Y-%m-%d')
            </if>
        </where>
    </select>
    <select id="selectAlarmBack" resultType="com.njcn.process.pojo.po.SupvAlarmBack">
        select
            sab.*,
            sab.complete_Time as time,
            sa.bill_No,
            sa.bill_Name
        from
            supv_alarm sa
        INNER JOIN supv_alarm_back sab on sab.work_Alarm_Id = sa.Alarm_Id
    </select>
</mapper>
