<?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.fidms.web.mapper.InfraredOutputMapper">
    
    <resultMap type="InfraredOutput" id="InfraredOutputResult">
        <result property="id"    column="id"    />
        <result property="flowFieldOutputID" column="flow_field_output_id"/>
        <result property="infraredInputID" column="infrared_input_id"/>
        <result property="outputFile"    column="output_file"    />
        <result property="outputFilePath"    column="output_file_path"    />
        <result property="radiationIntensity"    column="radiation_intensity"    />
        <result property="infraredImage"    column="infrared_image"    />
        <result property="infraredImagePath"    column="infrared_image_path"    />
        <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="selectInfraredOutputVo">
        select id, flow_field_output_id,infrared_input_id,output_file, output_file_path, radiation_intensity, infrared_image,infrared_image_path,create_by, create_time, update_by, update_time from bz_infrared_output_t
    </sql>

    <select id="selectInfraredOutputList" parameterType="InfraredOutput" resultMap="InfraredOutputResult">
        <include refid="selectInfraredOutputVo"/>
        <where>
            <if test="flowFieldOutputID != null">and flow_field_output_id=#{flowFieldOutputID},</if>
            <if test="infraredInputID != null">and infrared_input_id=#{infraredInputID},</if>
            <if test="outputFile != null  and outputFile != ''"> and output_file = #{outputFile}</if>
            <if test="outputFilePath != null  and outputFilePath != ''"> and output_file_path = #{outputFilePath}</if>
            <if test="radiationIntensity != null "> and radiation_intensity = #{radiationIntensity}</if>
            <if test="infraredImage != null  and infraredImage != ''"> and infrared_image = #{infraredImage}</if>
            <if test="infraredImagePath != null  and infraredImagePath != ''"> and infrared_image_path = #{infraredImagePath}</if>
        </where>
    </select>
    
    <select id="selectInfraredOutputById" parameterType="Long" resultMap="InfraredOutputResult">
        <include refid="selectInfraredOutputVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertInfraredOutput" parameterType="InfraredOutput" useGeneratedKeys="true" keyProperty="id">
        insert into bz_infrared_output_t
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="flowFieldOutputID != null">flow_field_output_id,</if>
            <if test="infraredInputID != null">infrared_input_id,</if>
            <if test="outputFile != null">output_file,</if>
            <if test="outputFilePath != null">output_file_path,</if>
            <if test="radiationIntensity != null">radiation_intensity,</if>
            <if test="infraredImage != null">infrared_image,</if>
            <if test="infraredImagePath != null">infrared_image_path,</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="flowFieldOutputID !=null">#{flowFieldOutputID},</if>
            <if test="infraredInputID != null">#{infraredInputID},</if>
            <if test="outputFile != null">#{outputFile},</if>
            <if test="outputFilePath != null">#{outputFilePath},</if>
            <if test="radiationIntensity != null">#{radiationIntensity},</if>
            <if test="infraredImage != null">#{infraredImage},</if>
            <if test="infraredImagePath != null">#{infraredImagePath},</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>

    <update id="updateInfraredOutput" parameterType="InfraredOutput">
        update bz_infrared_output_t
        <trim prefix="SET" suffixOverrides=",">
            <if test="flowFieldOutputID != null">flow_field_output_id= #{flowFieldOutputID},</if>
            <if test="infraredInputID != null">infrared_input_id= #{infraredInputID},</if>
            <if test="outputFile != null">output_file = #{outputFile},</if>
            <if test="outputFilePath != null">output_file_path = #{outputFilePath},</if>
            <if test="radiationIntensity != null">radiation_intensity = #{radiationIntensity},</if>
            <if test="infraredImage != null">infrared_image = #{infraredImage},</if>
            <if test="infraredImagePath != null">infrared_image_path = #{infraredImagePath},</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="deleteInfraredOutputById" parameterType="Long">
        delete from bz_infrared_output_t where id = #{id}
    </delete>

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