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

    <sql id="Base_Column_List">
            id as id,
            site_id as siteId,
            site_eqm_code as siteEqmCode,
            begin_time as beginTime,
            end_time as endTime,
            created_time as createdTime
    </sql>

     <select id="getBusiTransfromTemperatureExcess" parameterType="java.lang.String" resultType="com.huatek.busi.entity.BusiTransfromTemperatureExcess">
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        busi_transfrom_temperature_excess t
        WHERE t.site_id = #{siteId} and t.site_eqm_code = #{siteEqmCode}
        ORDER BY t.created_time DESC
        LIMIT 1
    </select>
    
    <select id="getEvalatuData" resultType="com.huatek.busi.entity.BusiTransfromTemperatureExcess">
    	SELECT
       	 <include refid="Base_Column_List"/>
        FROM
        busi_transfrom_temperature_excess t
    	<where>
			<if test="mainEquipmentId != null  and mainEquipmentId !='' ">
				t.site_eqm_code = #{mainEquipmentId}
			</if>
			<if test="startTime != null">
				and begin_time <![CDATA[>=]]> #{startTime}
			</if>
			<if test="endTime != null">
				and end_time <![CDATA[<=]]> #{endTime}
			</if>
		</where>
    </select>
    

</mapper>