<?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.huatek.busi.mapper.TransformerEpaDataStatisticsMapper">

    <sql id="Base_Column_List">
            id as id,
            d_time as dTime,
            phase as phase,
            h2 as h2,
            ch4 as ch4,
            c2h6 as c2h6,
            c2h4 as c2h4,
            c2h2 as c2h2,
            co as co,
            co2 as co2,
            o2 as o2,
            n2 as n2,
            total_hydrocarbon as totalHydrocarbon,
            cac_id as cacId,
            sensor_id as sensorId,
            gas_press as gasPress,
            h2o as h2o,
            site_id as siteId,
            equipment_id as equipmentId,
            sub_equipment_id as subEquipmentId,
            main_equipment_id as mainEquipmentId
    </sql>
    <select id="findIntervalDate" resultType="com.huatek.busi.entity.TransformerEpaDataStatistics">
    	SELECT
		  <include refid="Base_Column_List"/>
		FROM transformer_epa_data_statistics t
		WHERE t.site_id = #{siteId}
		AND t.main_equipment_id = #{mainEquipmentId}
		AND t.sub_equipment_id = #{subEquipmentId}
		AND t.d_time = #{dTime}
		ORDER BY t.d_time DESC LIMIT 1
    </select>
</mapper>