<?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.TransformerEpaIncreaseStatisticsMapper">

    <sql id="Base_Column_List">
            id as id,
            d_time as dTime,
            h2_increase as h2Increase,
            ch4_increase as ch4Increase,
            c2h6_increase as c2h6Increase,
            c2h4_increase as c2h4Increase,
            c2h2_increase as c2h2Increase,
            co_increase as coIncrease,
            o2_increase as o2Increase,
            n2_increase as n2Increase,
            co2_increase as co2Increase,
            h2o_increase as h2oIncrease,
            total_hydrocarbon_increase as totalHydrocarbonIncrease,
            site_id as siteId,
            equipment_id as equipmentId,
            sub_equipment_id as subEquipmentId,
            main_equipment_id as mainEquipmentId,
            main_tree_id as mainTreeId,
            sub_tree_id as subTreeId,
            sensor_code as sensorCode
    </sql>
    <select id="getTransformerEpaIncreaseStatistics" parameterType="com.huatek.busi.entity.TransformerEpaIncreaseStatistics"
    	resultType="com.huatek.busi.entity.TransformerEpaIncreaseStatistics">
    	SELECT
		  <include refid="Base_Column_List"></include>
		FROM transformer_epa_increase_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>

	<select id="getGrowthRateMap" resultType="java.util.Map">
		SELECT
			t.h2_increase as h2Increase,
			t.ch4_increase as ch4Increase,
			t.c2h6_increase as c2h6Increase,
			t.c2h4_increase as c2h4Increase,
			t.c2h2_increase as c2h2Increase,
			t.co_increase as coIncrease,
			t.o2_increase as o2Increase,
			t.n2_increase as n2Increase,
			t.co2_increase as co2Increase,
			t.h2o_increase as h2oIncrease,
			t.total_hydrocarbon_increase as totalHydrocarbonIncrease
		FROM
			transformer_epa_increase_statistics t
		WHERE
			t.sensor_code = #{sensorCode} AND t.d_time = #{day}
	</select>
</mapper>