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

    <sql id="Base_Column_List">
            id as id,
            site_id as siteId,
            eqm_id as eqmId,
            box_temper as boxTemper,
            box_sensor_id as boxSensorId,
            box_outside_temper as boxOutsideTemper,
            box_outside_sensor_id as boxOutsideSensorId,
            a_i_temper as aITemper,
            a_i_sensor_id as aISensorId,
            a_o_temper as aOTemper,
            a_o_sensor_id as aOSensorId,
            b_i_temper as bITemper,
            b_i_sensor_id as bISensorId,
            b_o_temper as bOTemper,
            b_o_sensor_id as bOSensorId,
            c_i_temper as cITemper,
            c_i_sensor_id as cISensorId,
            c_o_temper as cOTemper,
            c_o_sensor_id as cOSensorId,
            create_time as createTime
    </sql>

    <select id="selectRptTemperPage" parameterType="com.huatek.busi.dto.RptTemperDto" resultType="com.huatek.busi.vo.RptTemperVo">
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        rpt_temper t
        WHERE 1=1
        <if test="id != null and id != ''">
             and t.id = #{id}
        </if>
        <if test="siteId != null and siteId != ''">
             and t.site_id = #{siteId}
        </if>
        <if test="eqmId != null and eqmId != ''">
             and t.eqm_id = #{eqmId}
        </if>
        <if test="boxTemper != null">
             and t.box_temper = #{boxTemper}
        </if>
        <if test="boxSensorId != null and boxSensorId != ''">
             and t.box_sensor_id = #{boxSensorId}
        </if>
        <if test="boxOutsideTemper != null">
             and t.box_outside_temper = #{boxOutsideTemper}
        </if>
        <if test="boxOutsideSensorId != null and boxOutsideSensorId != ''">
             and t.box_outside_sensor_id = #{boxOutsideSensorId}
        </if>
        <if test="aITemper != null">
             and t.a_i_temper = #{aITemper}
        </if>
        <if test="aISensorId != null and aISensorId != ''">
             and t.a_i_sensor_id = #{aISensorId}
        </if>
        <if test="aOTemper != null">
             and t.a_o_temper = #{aOTemper}
        </if>
        <if test="aOSensorId != null and aOSensorId != ''">
             and t.a_o_sensor_id = #{aOSensorId}
        </if>
        <if test="bITemper != null">
             and t.b_i_temper = #{bITemper}
        </if>
        <if test="bISensorId != null and bISensorId != ''">
             and t.b_i_sensor_id = #{bISensorId}
        </if>
        <if test="bOTemper != null">
             and t.b_o_temper = #{bOTemper}
        </if>
        <if test="bOSensorId != null and bOSensorId != ''">
             and t.b_o_sensor_id = #{bOSensorId}
        </if>
        <if test="cITemper != null">
             and t.c_i_temper = #{cITemper}
        </if>
        <if test="cISensorId != null and cISensorId != ''">
             and t.c_i_sensor_id = #{cISensorId}
        </if>
        <if test="cOTemper != null">
             and t.c_o_temper = #{cOTemper}
        </if>
        <if test="cOSensorId != null and cOSensorId != ''">
             and t.c_o_sensor_id = #{cOSensorId}
        </if>
        <if test="createTime != null">
             and t.create_time = #{createTime}
        </if>
    </select>

	<select id="getRptTemper" parameterType="java.lang.String" resultType="com.huatek.busi.entity.RptTemper">
		SELECT
			<include refid="Base_Column_List"/>
		FROM
			rpt_temper t
		WHERE
			t.site_id = #{siteId} and t.eqm_id = #{siteEqmCode}
	</select>
</mapper>