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

    <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_leakage_current_warning as aLeakageCurrentWarning,
            a_leakage_current_threshold as aLeakageCurrentThreshold,
            a_capacitance_warning as aCapacitanceWarning,
            a_capacitance_threshold as aCapacitanceThreshold,
            a_loss_factor_warning as aLossFactorWarning,
            a_loss_factor_threshold as aLossFactorThreshold,
            b_leakage_current_warning as bLeakageCurrentWarning,
            b_leakage_current_threshold as bLeakageCurrentThreshold,
            b_capacitance_warning as bCapacitanceWarning,
            b_capacitance_threshold as bCapacitanceThreshold,
            b_loss_factor_warning as bLossFactorWarning,
            b_loss_factor_threshold as bLossFactorThreshold,
            c_leakage_current_warning as cLeakageCurrentWarning,
            c_leakage_current_threshold as cLeakageCurrentThreshold,
            c_capacitance_warning as cCapacitanceWarning,
            c_capacitance_threshold as cCapacitanceThreshold,
            c_loss_factor_warning as cLossFactorWarning,
            c_loss_factor_threshold as cLossFactorThreshold,
            created_time as createdTime,
            creator as creator,
            modified_time as modifiedTime,
            modifier as modifier
    </sql>
    <select id="getCapacitanceEquipmentInsulationMonitorThreshold" resultType="com.huatek.busi.entity.CapacitanceEquipmentInsulationMonitorThreshold">
    	SELECT
		  <include refid="Base_Column_List" />
		FROM capacitance_equipment_insulation_monitor_threshold t
		<where>
			AND t.run_state = #{state}
			AND t.sensor_code = #{sensorCode}
			<if test="mainTreeId != null and mainTreeId != ''">
				AND t.main_tree_id = #{mainTreeId}
			</if>
		</where>
    </select>
    <select id="getThresholdVo" resultType="com.huatek.busi.vo.CapacitanceEquipmentInsulationMonitorThresholdVo">
    	SELECT
		  <include refid="Base_Column_List" />
		FROM capacitance_equipment_insulation_monitor_threshold t
		WHERE t.run_state = #{state}
			AND t.sensor_code = #{sensorCode}
    </select>
</mapper>