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

    <sql id="Base_Column_List">
            id as id,
            site_id as siteId,
            main_equipment_id as mainEquipmentId,
            transformer_name as transformerName,
            equipment_delivery_time as equipmentDeliveryTime,
            equipment_code as equipmentCode,
            site_code as siteCode,
            specific_gravity as specificGravity,
            equipment_model as equipmentModel,
            factory_time as factoryTime,
            rated_capacity as ratedCapacity,
            cooling_node as coolingNode,
            manufacturer as manufacturer,
            rated_high_voltage as ratedHighVoltage,
            rated_low_voltage as ratedLowVoltage,
            rated_high_current as ratedHighCurrent,
            rated_low_current as ratedLowCurrent,
            oil_weight as oilWeight,
            design_life as designLife,
            environment_level as environmentLevel,
            health_aassessment_start_time as healthAassessmentStartTime,
            create_user as createUser,
            create_time as createTime,
            status as status
    </sql>

	<select id="getBusiOfflineTransformerBrandVo" parameterType="java.lang.String"
			resultType="com.huatek.busi.vo.BusiOfflineTransformerBrandVo">
		SELECT
        <include refid="Base_Column_List"/>
        FROM
        busi_offline_transformer_brand t
        WHERE t.main_equipment_id = #{mainEquipmentId}
             and t.`status` = 1
        <if test="siteId != null and siteId != ''">
        	and t.site_id = #{siteId}
        </if>
	</select>

	<select id="getBusiOfflineTransformerBrand" parameterType="java.lang.String"
			resultType="com.huatek.busi.entity.BusiOfflineTransformerBrand">
		SELECT
        <include refid="Base_Column_List"/>
        FROM
        busi_offline_transformer_brand t
        WHERE t.main_equipment_id = #{mainEquipmentId}
        <if test="siteId != null and siteId != ''">
        	and t.site_id = #{siteId}
        </if>
	</select>

	<select id="findAll"
			resultType="com.huatek.busi.entity.BusiOfflineTransformerBrand">
		SELECT
        <include refid="Base_Column_List"/>
        FROM
        busi_offline_transformer_brand t
        where t.status = '1'
	</select>

    <select id="getStartTime" resultType="java.util.Date">
        SELECT
            equipment_delivery_time AS startTime
        FROM
            busi_offline_transformer_brand
        WHERE
            main_equipment_id = #{mainTreeId}
            AND `status` = '1'
    </select>
</mapper>
