<?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.mirs.biz.mapper.IntegratedDataMapper">
    
    <resultMap type="IntegratedData" id="IntegratedDataResult">
        <result property="id"    column="id"    />
        <result property="sampleModel"    column="sample_model"    />
        <result property="temperatureK"    column="temperature_k"    />
        <result property="wavelengthUm"    column="wavelength_um"    />
        <result property="integralValue1"    column="integral_value1"    />
        <result property="integralValue2"    column="integral_value2"    />
        <result property="integralValue3"    column="integral_value3"    />
        <result property="integralValue4"    column="integral_value4"    />
        <result property="integralValue5"    column="integral_value5"    />
        <result property="standardDev"    column="standard_dev"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectIntegratedDataVo">
        select id, sample_model, temperature_k, wavelength_um, integral_value1, integral_value2, integral_value3, integral_value4, integral_value5, standard_dev, create_by, create_time, update_by, update_time from biz_integrated_data_t
    </sql>

    <select id="selectIntegratedDataList" parameterType="IntegratedData" resultMap="IntegratedDataResult">
        <include refid="selectIntegratedDataVo"/>
        <where>  
            <if test="sampleModel != null  and sampleModel != ''"> and sample_model = #{sampleModel}</if>
            <if test="temperatureK != null "> and temperature_k = #{temperatureK}</if>
            <if test="wavelengthUm != null  and wavelengthUm != ''"> and wavelength_um = #{wavelengthUm}</if>
        </where>
    </select>
    
    <select id="selectIntegratedDataById" parameterType="Long" resultMap="IntegratedDataResult">
        <include refid="selectIntegratedDataVo"/>
        where id = #{id}
    </select>

    <insert id="insertIntegratedData" parameterType="IntegratedData" useGeneratedKeys="true" keyProperty="id">
        insert into biz_integrated_data_t
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="sampleModel != null">sample_model,</if>
            <if test="temperatureK != null">temperature_k,</if>
            <if test="wavelengthUm != null">wavelength_um,</if>
            <if test="integralValue1 != null">integral_value1,</if>
            <if test="integralValue2 != null">integral_value2,</if>
            <if test="integralValue3 != null">integral_value3,</if>
            <if test="integralValue4 != null">integral_value4,</if>
            <if test="integralValue5 != null">integral_value5,</if>
            <if test="standardDev != null">standard_dev,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sampleModel != null">#{sampleModel},</if>
            <if test="temperatureK != null">#{temperatureK},</if>
            <if test="wavelengthUm != null">#{wavelengthUm},</if>
            <if test="integralValue1 != null">#{integralValue1},</if>
            <if test="integralValue2 != null">#{integralValue2},</if>
            <if test="integralValue3 != null">#{integralValue3},</if>
            <if test="integralValue4 != null">#{integralValue4},</if>
            <if test="integralValue5 != null">#{integralValue5},</if>
            <if test="standardDev != null">#{standardDev},</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>
         </trim>
    </insert>

    <insert id="batchInsertIntegratedData" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO biz_integrated_data_t (
        sample_model,
        temperature_k,
        wavelength_um,
        integral_value1,
        integral_value2,
        integral_value3,
        integral_value4,
        integral_value5,
        standard_dev,
        create_by,
        create_time,
        update_by,
        update_time
        ) VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.sampleModel},
            #{item.temperatureK},
            #{item.wavelengthUm},
            #{item.integralValue1},
            #{item.integralValue2},
            #{item.integralValue3},
            #{item.integralValue4},
            #{item.integralValue5},
            #{item.standardDev},
            #{item.createBy},
            #{item.createTime},
            #{item.updateBy},
            #{item.updateTime}
            )
        </foreach>
    </insert>

    <update id="updateIntegratedData" parameterType="IntegratedData">
        update biz_integrated_data_t
        <trim prefix="SET" suffixOverrides=",">
            <if test="sampleModel != null">sample_model = #{sampleModel},</if>
            <if test="temperatureK != null">temperature_k = #{temperatureK},</if>
            <if test="wavelengthUm != null">wavelength_um = #{wavelengthUm},</if>
            <if test="integralValue1 != null">integral_value1 = #{integralValue1},</if>
            <if test="integralValue2 != null">integral_value2 = #{integralValue2},</if>
            <if test="integralValue3 != null">integral_value3 = #{integralValue3},</if>
            <if test="integralValue4 != null">integral_value4 = #{integralValue4},</if>
            <if test="integralValue5 != null">integral_value5 = #{integralValue5},</if>
            <if test="standardDev != null">standard_dev = #{standardDev},</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>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIntegratedDataById" parameterType="Long">
        delete from biz_integrated_data_t where id = #{id}
    </delete>

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