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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.huatek.busi.vo.HotSpotTemperatureResultVo">
        <id column="id" property="id" />
        <result column="site_id" property="siteId" />
        <result column="main_tree_id" property="mainTreeId" />
        <result column="assess_time" property="assessTime" />
        <result column="environment_temperature" property="environmentTemperature" />
        <result column="top_oil_temperature" property="topOilTemperature" />
        <result column="loss_ratio" property="lossRatio" />
        <result column="load_coefficient" property="loadCoefficient" />
        <result column="Index_of_oil" property="indexOfOil" />
        <result column="winding_temperature" property="windingTemperature" />
        <result column="winding_index" property="windingIndex" />
        <result column="aging_coefficient" property="agingCoefficient" />
        <result column="co2" property="co2" />
        <result column="co" property="co" />
        <result column="result" property="result" />
        <result column="type" property="type" />
        <result column="arithmetic_ype" property="arithmeticType" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="BaseColumnList">
        id, site_id , main_tree_id, assess_time, environment_temperature, top_oil_temperature, loss_ratio, load_coefficient, Index_of_oil, winding_temperature, winding_index, aging_coefficient, co2, co, result, type, arithmetic_ype
    </sql>

    <select id = "findByParams" parameterType="java.lang.String" resultMap="BaseResultMap">
        SELECT
        <include refid="BaseColumnList"/>
        FROM
        hot_spot_temperature_result A
        <where>
            <if test="siteId != null and siteId != '' ">
                and A.site_id = #{siteId}
            </if>
            <if test="mainTreeId != null and mainTreeId != '' ">
                and A.main_tree_id = #{mainTreeId}
            </if>
            <if test="startTime != null and startTime != '' ">
                and A.assess_time &gt;= #{startTime}
            </if>
            <if test="endTime != null and endTime != '' ">
                and A.assess_time &lt;= #{endTime}
            </if>
            <if test="type != null and type != '' ">
                and A.type = #{type}
            </if>
        </where>
        order by A.assess_time desc


    </select>

</mapper>
