<?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="FullLaunchRate"    column="full_launch_rate"    />
        <result property="DamageLaunchRate"    column="damage_launch_rate"    />
        <result property="DamageArea"    column="damage_area"    />
        <result property="DamageAreaRatio"    column="damage_area_ratio"    />
        <result property="SurfaceDescription"    column="surface_description"    />
        <result property="DetectDistance"    column="detect_distance"    />
        <result property="DetectAngle"    column="detect_angle"    />
        <result property="InfraredBand"    column="infrared_band"    />
        <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, full_launch_rate, damage_launch_rate, damage_area, damage_area_ratio, surface_description, detect_distance, detect_angle,infrared_band, 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="FullLaunchRate != null "> and full_launch_rate = #{FullLaunchRate}</if>
            <if test="DamageLaunchRate != null "> and damage_launch_rate = #{DamageLaunchRate}</if>
            <if test="DamageArea != null "> and damage_area = #{DamageArea}</if>
            <if test="DamageAreaRatio != null "> and damage_area_ratio = #{DamageAreaRatio}</if>
            <if test="SurfaceDescription != null "> and surface_description = #{SurfaceDescription}</if>
            <if test="DetectDistance != null "> and detect_distance = #{DetectDistance}</if>
            <if test="DetectAngle != null "> and detect_angle = #{DetectAngle}</if>
            <if test="InfraredBand != null "> and infrared_band = #{InfraredBand}</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="FullLaunchRate != null">full_launch_rate,</if>
            <if test="DamageLaunchRate != null">damage_launch_rate,</if>
            <if test="DamageArea != null">damage_area,</if>
            <if test="DamageAreaRatio != null">damage_area_ratio,</if>
            <if test="SurfaceDescription != null">surface_description,</if>
            <if test="DetectDistance != null">detect_distance,</if>
            <if test="DetectAngle != null">detect_angle,</if>
            <if test="InfraredBand != null">infrared_band,</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="FullLaunchRate != null">#{FullLaunchRate},</if>
            <if test="DamageLaunchRate != null">#{DamageLaunchRate},</if>
            <if test="DamageArea != null">#{DamageArea},</if>
            <if test="DamageAreaRatio != null">#{DamageAreaRatio},</if>
            <if test="SurfaceDescription != null">#{SurfaceDescription},</if>
            <if test="DetectDistance != null">#{DetectDistance},</if>
            <if test="DetectAngle != null">#{DetectAngle},</if>
            <if test="InfraredBand != null">#{InfraredBand},</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="FullLaunchRate != null">full_launch_rate = #{FullLaunchRate},</if>
            <if test="DamageLaunchRate != null">damage_launch_rate = #{DamageLaunchRate},</if>
            <if test="DamageArea != null">damage_area = #{DamageArea},</if>
            <if test="DamageAreaRatio != null">damage_area_ratio = #{DamageAreaRatio},</if>
            <if test="SurfaceDescription != null">surface_description = #{SurfaceDescription},</if>
            <if test="DetectDistance != null">detect_distance = #{DetectDistance},</if>
            <if test="DetectAngle != null">detect_angle = #{DetectAngle},</if>
            <if test="InfraredBand != null">infrared_band = #{InfraredBand},</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>

    <select id="getInfraredInputOption" resultType="Map">
        select id from bz_infrared_input_t order by id desc
    </select>
</mapper>