<?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="cn.com.ty.lift.batch.applet.dao.mapper.EmergencyRepairDataMapper">

    <!-- 通过时间获取指定时间段内的急修记录信息 -->
    <select id="getEmergencyRepairDataList" parameterType="cn.com.ty.lift.batch.applet.dao.model.request.CommonRequest"
            resultType="cn.com.ty.lift.batch.applet.dao.model.EmergencyRepairDataModel">
        select
            er.create_date as callerDate,
            er.arrive_time as arriveTime,
            er.assign_time as assignTime,
            er.create_date as createTime,
            er.mt_company_id as mtCompanyId,
            er.recovery_date as recoveryDate,
            er.taking_time as takingTime,
            p.project_name as projectName,
            p.region_id as regionId
        from
            emergency_repair er
        left join
            project p
        on
            er.project_id = p.id
        where
            true
        <if test = "mtCompanyId !=  null">
            and er.mt_company_id = #{mtCompanyId}
        </if>
        and
            er.create_date <![CDATA[ >= ]]> #{startTimeDateStr}
        and
            er.create_date <![CDATA[ <= ]]> #{endTimeDateStr}
    </select>

</mapper>