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

    <sql id="Base_Column_List">
            id as id,
            site_id as siteId,
            main_tree_id as mainTreeId,
            sensor_code as sensorCode,
            run_state as runState,
            a_full_current_warning as aFullCurrentWarning,
            a_full_current_threshold as aFullCurrentThreshold,
            a_full_current_growth_rate as aFullCurrentGrowthRate,
            b_full_current_warning as bFullCurrentWarning,
            b_full_current_threshold as bFullCurrentThreshold,
            b_full_current_growth_rate as bFullCurrentGrowthRate,
            c_full_current_warning as cFullCurrentWarning,
            c_full_current_threshold as cFullCurrentThreshold,
            c_full_current_growth_rate as cFullCurrentGrowthRate,
            a_resistive_current_warning as aResistiveCurrentWarning,
            a_resistive_current_threshold as aResistiveCurrentThreshold,
            a_resistive_current_growth_rate as aResistiveCurrentGrowthRate,
            b_resistive_current_warning as bResistiveCurrentWarning,
            b_resistive_current_threshold as bResistiveCurrentThreshold,
            b_resistive_current_growth_rate as bResistiveCurrentGrowthRate,
            c_resistive_current_warning as cResistiveCurrentWarning,
            c_resistive_current_threshold as cResistiveCurrentThreshold,
            c_resistive_current_growth_rate as cResistiveCurrentGrowthRate,
            a_capacitance_current_warning as aCapacitanceCurrentWarning,
            a_capacitance_current_threshold as aCapacitanceCurrentThreshold,
            a_capacitance_current_growth_rate as aCapacitanceCurrentGrowthRate,
            b_capacitance_current_warning as bCapacitanceCurrentWarning,
            b_capacitance_current_threshold as bCapacitanceCurrentThreshold,
            b_capacitance_current_growth_rate as bCapacitanceCurrentGrowthRate,
            c_capacitance_current_warning as cCapacitanceCurrentWarning,
            c_capacitance_current_threshold as cCapacitanceCurrentThreshold,
            c_capacitance_current_growth_rate as cCapacitanceCurrentGrowthRate,
            created_time as createdTime,
            creator as creator,
            modified_time as modifiedTime,
            modifier as modifier
    </sql>
    <select id="getArresterInsulationMonitorThreshold" resultType="com.huatek.busi.entity.ArresterInsulationMonitorThreshold">
    	SELECT
		  <include refid="Base_Column_List"></include>
		FROM arrester_insulation_monitor_threshold t
		WHERE t.run_state = #{state}
			AND t.sensor_code = #{sensorCode}
		<if test="mainTreeId != null and mainTreeId != ''">
			AND t.main_tree_id = #{mainTreeId}
		</if>
    </select>
    <select id="getThresholdVo" resultType="com.huatek.busi.vo.ArresterInsulationMonitorThresholdVo">
    	SELECT
		  <include refid="Base_Column_List"></include>
		FROM arrester_insulation_monitor_threshold t
		WHERE t.run_state = #{state}
			AND t.sensor_code = #{sensorCode}
    </select>
    
      <select id="getThresholdVoBysensorCode" resultType="com.huatek.busi.vo.ArresterInsulationMonitorThresholdVo">
    	SELECT
		  <include refid="Base_Column_List"></include>
		FROM arrester_insulation_monitor_threshold t
		WHERE t.sensor_code = #{sensorCode}
    </select>

    <select id="queryInsulationThresholdBySensorCode" parameterType="java.lang.String" resultType="com.huatek.busi.vo.ArresterInsulationMonitorThresholdVo">
        select
        <include refid="Base_Column_List" />
        from arrester_insulation_monitor_threshold
        <where>
            <if test="sensorCode != null and sensorCode != ''">
                sensor_code=#{sensorCode}
            </if>
        </where>
    </select>
</mapper>