<?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.ygtx.gxt.mapper.source.GxtShutdownRecordMapper">
    
    <resultMap type="com.ygtx.gxt.domain.GxtShutdownRecord" id="GxtShutdownRecordResult">
        <result property="regionCompanyName"    column="region_company_name"    />
        <result property="stationName"    column="station_name"    />
        <result property="turbineName"    column="turbine_name"    />
        <result property="monitorStatusName"    column="monitor_status_name"    />
        <result property="downtimeDesc"    column="downtime_desc"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="firstReasonDesc"    column="first_reason_desc"    />
        <result property="duration"    column="duration"    />
        <result property="remark"    column="remark"    />
        <result property="totalOutageLossElec"    column="total_outage_loss_elec"    />
        <result property="turbineModel"    column="turbine_model"    />
        <result property="turbineWt"    column="turbine_wt"    />
        <result property="dataGenTime"    column="data_gen_time"    />
        <result property="secondReasonDesc"    column="second_reason_desc"    />
        <result property="approvalStatus"    column="approval_status"    />
        <result property="downtimeIdPre"    column="downtime_id_pre"    />
        <result property="workOrderBizId"    column="work_order_biz_id"    />
    </resultMap>

    <select id="selectShutdownRecordsByDate" resultMap="GxtShutdownRecordResult">
        SELECT 
            region_company_name,
            station_name,
            turbine_name,
            monitor_status_name,
            downtime_desc,
            start_time,
            end_time,
            first_reason_desc,
            duration,
            remark,
            total_outage_loss_elec,
            turbine_model,
            turbine_wt,
            data_gen_time,
            second_reason_desc,
            approval_status,
            downtime_id_pre,
            work_order_biz_id
        FROM fujian_wind_turbine_downtime
        WHERE DATE(start_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
        <if test="monitorStatusName != null and monitorStatusName != ''">
            AND FIND_IN_SET(monitor_status_name, #{monitorStatusName})
        </if>
        ORDER BY start_time DESC
    </select>

</mapper>