<?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.cirs.biz.mapper.TElectronComponentMapper">
    
    <resultMap type="TElectronComponent" id="TElectronComponentResult">
        <result property="id"    column="id"    />
        <result property="componentName"    column="component_name"    />
        <result property="manufacturer"    column="manufacturer"    />
        <result property="componentModel"    column="component_model"    />
        <result property="replaceDomesticModel"    column="replace_domestic_model"    />
        <result property="qualityGrade"    column="quality_grade"    />
        <result property="deliveryCycle"    column="delivery_cycle"    />
        <result property="supplyQuantity"    column="supply_quantity"    />
        <result property="unitPrice"    column="unit_price"    />
        <result property="zzkkLevel"    column="zzkk_level"    />
        <result property="inPreference"    column="in_preference"    />
        <result property="shutdownDate"    column="shutdown_date"    />
        <result property="encapsulationMode"    column="encapsulation_mode"    />
        <result property="paramIfm"    column="param_ifm"    />
        <result property="paramVrrm"    column="param_vrrm"    />
        <result property="paramIfsm"    column="param_ifsm"    />
        <result property="paramZz"    column="param_zz"    />
        <result property="paramPcm"    column="param_pcm"    />
        <result property="paramIcm"    column="param_icm"    />
        <result property="paramVcbo"    column="param_vcbo"    />
        <result property="paramVceo"    column="param_vceo"    />
        <result property="paramVebo"    column="param_vebo"    />
        <result property="paramVdss"    column="param_vdss"    />
        <result property="paramId"    column="param_id"    />
        <result property="paramRdsOn"    column="param_RDS_on"    />
        <result property="antistaticCapacity"    column="antistatic_capacity"    />
        <result property="radiationResistance"    column="radiation_resistance"    />
        <result property="materials"    column="materials"    />
        <result property="craft"    column="craft"    />
        <result property="weight"    column="weight"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectTElectronComponentVo">
        select id, component_name, manufacturer, component_model, replace_domestic_model, quality_grade, delivery_cycle, supply_quantity, unit_price, zzkk_level, in_preference, shutdown_date, encapsulation_mode, param_ifm, param_vrrm, param_ifsm, param_zz, param_pcm, param_icm, param_vcbo, param_vceo, param_vebo, param_vdss, param_id, param_RDS_on, antistatic_capacity, radiation_resistance, materials, craft, weight, create_by, create_time, update_by, update_time, remark from t_electron_component
    </sql>

    <select id="selectTElectronComponentList" parameterType="TElectronComponent" resultMap="TElectronComponentResult">
        <include refid="selectTElectronComponentVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="componentName != null  and componentName != ''"> and component_name like concat('%', #{componentName}, '%')</if>
            <if test="manufacturer != null  and manufacturer != ''"> and manufacturer = #{manufacturer}</if>
            <if test="componentModel != null  and componentModel != ''"> and component_model = #{componentModel}</if>
            <if test="replaceDomesticModel != null  and replaceDomesticModel != ''"> and replace_domestic_model = #{replaceDomesticModel}</if>
            <if test="qualityGrade != null  and qualityGrade != ''"> and quality_grade = #{qualityGrade}</if>
            <if test="deliveryCycle != null "> and delivery_cycle = #{deliveryCycle}</if>
            <if test="supplyQuantity != null "> and supply_quantity = #{supplyQuantity}</if>
            <if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
            <if test="zzkkLevel != null  and zzkkLevel != ''"> and zzkk_level = #{zzkkLevel}</if>
            <if test="inPreference != null  and inPreference != ''"> and in_preference = #{inPreference}</if>
            <if test="shutdownDate != null "> and shutdown_date = #{shutdownDate}</if>
            <if test="encapsulationMode != null  and encapsulationMode != ''"> and encapsulation_mode = #{encapsulationMode}</if>
            <if test="paramIfm != null "> and param_ifm = #{paramIfm}</if>
            <if test="paramVrrm != null "> and param_vrrm = #{paramVrrm}</if>
            <if test="paramIfsm != null "> and param_ifsm = #{paramIfsm}</if>
            <if test="paramZz != null "> and param_zz = #{paramZz}</if>
            <if test="paramPcm != null "> and param_pcm = #{paramPcm}</if>
            <if test="paramIcm != null "> and param_icm = #{paramIcm}</if>
            <if test="paramVcbo != null "> and param_vcbo = #{paramVcbo}</if>
            <if test="paramVceo != null "> and param_vceo = #{paramVceo}</if>
            <if test="paramVebo != null "> and param_vebo = #{paramVebo}</if>
            <if test="paramVdss != null "> and param_vdss = #{paramVdss}</if>
            <if test="paramId != null "> and param_id = #{paramId}</if>
            <if test="paramRdsOn != null "> and param_RDS_on = #{paramRdsOn}</if>
            <if test="antistaticCapacity != null  and antistaticCapacity != ''"> and antistatic_capacity = #{antistaticCapacity}</if>
            <if test="radiationResistance != null  and radiationResistance != ''"> and radiation_resistance = #{radiationResistance}</if>
            <if test="materials != null  and materials != ''"> and materials = #{materials}</if>
            <if test="craft != null  and craft != ''"> and craft = #{craft}</if>
            <if test="weight != null  and weight != ''"> and weight = #{weight}</if>
        </where>
    </select>
    
    <select id="selectTElectronComponentById" parameterType="Long" resultMap="TElectronComponentResult">
        <include refid="selectTElectronComponentVo"/>
        where id = #{id}
    </select>
    <select id="getAll" resultType="com.cirs.biz.domain.TElectronComponent" resultMap="TElectronComponentResult">
        <include refid="selectTElectronComponentVo"/>
    </select>

    <insert id="insertTElectronComponent" parameterType="TElectronComponent" useGeneratedKeys="true" keyProperty="id">
        insert into t_electron_component
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="componentName != null">component_name,</if>
            <if test="manufacturer != null">manufacturer,</if>
            <if test="componentModel != null">component_model,</if>
            <if test="replaceDomesticModel != null">replace_domestic_model,</if>
            <if test="qualityGrade != null">quality_grade,</if>
            <if test="deliveryCycle != null">delivery_cycle,</if>
            <if test="supplyQuantity != null">supply_quantity,</if>
            <if test="unitPrice != null">unit_price,</if>
            <if test="zzkkLevel != null">zzkk_level,</if>
            <if test="inPreference != null">in_preference,</if>
            <if test="shutdownDate != null">shutdown_date,</if>
            <if test="encapsulationMode != null">encapsulation_mode,</if>
            <if test="paramIfm != null">param_ifm,</if>
            <if test="paramVrrm != null">param_vrrm,</if>
            <if test="paramIfsm != null">param_ifsm,</if>
            <if test="paramZz != null">param_zz,</if>
            <if test="paramPcm != null">param_pcm,</if>
            <if test="paramIcm != null">param_icm,</if>
            <if test="paramVcbo != null">param_vcbo,</if>
            <if test="paramVceo != null">param_vceo,</if>
            <if test="paramVebo != null">param_vebo,</if>
            <if test="paramVdss != null">param_vdss,</if>
            <if test="paramId != null">param_id,</if>
            <if test="paramRdsOn != null">param_RDS_on,</if>
            <if test="antistaticCapacity != null">antistatic_capacity,</if>
            <if test="radiationResistance != null">radiation_resistance,</if>
            <if test="materials != null">materials,</if>
            <if test="craft != null">craft,</if>
            <if test="weight != null">weight,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="componentName != null">#{componentName},</if>
            <if test="manufacturer != null">#{manufacturer},</if>
            <if test="componentModel != null">#{componentModel},</if>
            <if test="replaceDomesticModel != null">#{replaceDomesticModel},</if>
            <if test="qualityGrade != null">#{qualityGrade},</if>
            <if test="deliveryCycle != null">#{deliveryCycle},</if>
            <if test="supplyQuantity != null">#{supplyQuantity},</if>
            <if test="unitPrice != null">#{unitPrice},</if>
            <if test="zzkkLevel != null">#{zzkkLevel},</if>
            <if test="inPreference != null">#{inPreference},</if>
            <if test="shutdownDate != null">#{shutdownDate},</if>
            <if test="encapsulationMode != null">#{encapsulationMode},</if>
            <if test="paramIfm != null">#{paramIfm},</if>
            <if test="paramVrrm != null">#{paramVrrm},</if>
            <if test="paramIfsm != null">#{paramIfsm},</if>
            <if test="paramZz != null">#{paramZz},</if>
            <if test="paramPcm != null">#{paramPcm},</if>
            <if test="paramIcm != null">#{paramIcm},</if>
            <if test="paramVcbo != null">#{paramVcbo},</if>
            <if test="paramVceo != null">#{paramVceo},</if>
            <if test="paramVebo != null">#{paramVebo},</if>
            <if test="paramVdss != null">#{paramVdss},</if>
            <if test="paramId != null">#{paramId},</if>
            <if test="paramRdsOn != null">#{paramRdsOn},</if>
            <if test="antistaticCapacity != null">#{antistaticCapacity},</if>
            <if test="radiationResistance != null">#{radiationResistance},</if>
            <if test="materials != null">#{materials},</if>
            <if test="craft != null">#{craft},</if>
            <if test="weight != null">#{weight},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTElectronComponent" parameterType="TElectronComponent">
        update t_electron_component
        <trim prefix="SET" suffixOverrides=",">
            <if test="componentName != null">component_name = #{componentName},</if>
            <if test="manufacturer != null">manufacturer = #{manufacturer},</if>
            <if test="componentModel != null">component_model = #{componentModel},</if>
            <if test="replaceDomesticModel != null">replace_domestic_model = #{replaceDomesticModel},</if>
            <if test="qualityGrade != null">quality_grade = #{qualityGrade},</if>
            <if test="deliveryCycle != null">delivery_cycle = #{deliveryCycle},</if>
            <if test="supplyQuantity != null">supply_quantity = #{supplyQuantity},</if>
            <if test="unitPrice != null">unit_price = #{unitPrice},</if>
            <if test="zzkkLevel != null">zzkk_level = #{zzkkLevel},</if>
            <if test="inPreference != null">in_preference = #{inPreference},</if>
            <if test="shutdownDate != null">shutdown_date = #{shutdownDate},</if>
            <if test="encapsulationMode != null">encapsulation_mode = #{encapsulationMode},</if>
            <if test="paramIfm != null">param_ifm = #{paramIfm},</if>
            <if test="paramVrrm != null">param_vrrm = #{paramVrrm},</if>
            <if test="paramIfsm != null">param_ifsm = #{paramIfsm},</if>
            <if test="paramZz != null">param_zz = #{paramZz},</if>
            <if test="paramPcm != null">param_pcm = #{paramPcm},</if>
            <if test="paramIcm != null">param_icm = #{paramIcm},</if>
            <if test="paramVcbo != null">param_vcbo = #{paramVcbo},</if>
            <if test="paramVceo != null">param_vceo = #{paramVceo},</if>
            <if test="paramVebo != null">param_vebo = #{paramVebo},</if>
            <if test="paramVdss != null">param_vdss = #{paramVdss},</if>
            <if test="paramId != null">param_id = #{paramId},</if>
            <if test="paramRdsOn != null">param_RDS_on = #{paramRdsOn},</if>
            <if test="antistaticCapacity != null">antistatic_capacity = #{antistaticCapacity},</if>
            <if test="radiationResistance != null">radiation_resistance = #{radiationResistance},</if>
            <if test="materials != null">materials = #{materials},</if>
            <if test="craft != null">craft = #{craft},</if>
            <if test="weight != null">weight = #{weight},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTElectronComponentById" parameterType="Long">
        delete from t_electron_component where id = #{id}
    </delete>

    <delete id="deleteTElectronComponentByIds" parameterType="String">
        delete from t_electron_component where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>