<?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.InfraredInputMapper">
    
    <resultMap type="InfraredInput" id="InfraredInputResult">
        <result property="id"    column="id"    />
        <result property="flowFieldOutputId"    column="flow_field_output_id"    />
        <result property="flowFieldOutputPath"    column="flow_field_output_path"    />
        <result property="surfaceMaterial"    column="surface_material"    />
        <result property="infraredObserDist"    column="infrared_obser_dist"    />
        <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="selectInfraredInputVo">
        select id, flow_field_output_id, flow_field_output_path, surface_material, infrared_obser_dist, create_by, create_time, update_by, update_time from bz_infrared_input_t
    </sql>

    <select id="selectInfraredInputList" parameterType="InfraredInput" resultMap="InfraredInputResult">
        <include refid="selectInfraredInputVo"/>
        <where>  
            <if test="flowFieldOutputId != null "> and flow_field_output_id = #{flowFieldOutputId}</if>
            <if test="flowFieldOutputPath != null "> and flow_field_output_path = #{flowFieldOutputPath}</if>
            <if test="surfaceMaterial != null "> and surface_material = #{surfaceMaterial}</if>
            <if test="infraredObserDist != null "> and infrared_obser_dist = #{infraredObserDist}</if>
        </where>
    </select>
    
    <select id="selectInfraredInputById" parameterType="Long" resultMap="InfraredInputResult">
        <include refid="selectInfraredInputVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertInfraredInput" parameterType="InfraredInput" useGeneratedKeys="true" keyProperty="id">
        insert into bz_infrared_input_t
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="flowFieldOutputId != null">flow_field_output_id,</if>
            <if test="flowFieldOutputPath != null">flow_field_output_path,</if>
            <if test="surfaceMaterial != null">surface_material,</if>
            <if test="infraredObserDist != null">infrared_obser_dist,</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="flowFieldOutputPath != null">#{flowFieldOutputPath},</if>
            <if test="surfaceMaterial != null">#{surfaceMaterial},</if>
            <if test="infraredObserDist != null">#{infraredObserDist},</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="updateInfraredInput" parameterType="InfraredInput">
        update bz_infrared_input_t
        <trim prefix="SET" suffixOverrides=",">
            <if test="flowFieldOutputId != null">flow_field_output_id = #{flowFieldOutputId},</if>
            <if test="flowFieldOutputPath != null">flow_field_output_path = #{flowFieldOutputPath},</if>
            <if test="surfaceMaterial != null">surface_material = #{surfaceMaterial},</if>
            <if test="infraredObserDist != null">infrared_obser_dist = #{infraredObserDist},</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="deleteInfraredInputById" parameterType="Long">
        delete from bz_infrared_input_t where id = #{id}
    </delete>

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