<?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.zehong.system.mapper.FProBehInforBrowseMapper">
    
    <resultMap type="FProBehInforBrowse" id="FProBehInforBrowseResult">
        <result property="fProBehInforId"    column="f_pro_beh_infor_id"    />
        <result property="fIdNo"    column="f_id_no"    />
        <result property="fExperEval"    column="f_exper_eval"    />
        <result property="fSelectionEvent"    column="f_selection_event"    />
        <result property="fSelectionStartTime"    column="f_selection_start_time"    />
        <result property="fScorDesc"    column="f_scor_desc"    />
        <result property="fUpdateTime"    column="f_update_time"    />
    </resultMap>

    <sql id="selectFProBehInforBrowseVo">
        select f_pro_beh_infor_id, f_id_no, f_exper_eval, f_selection_event, f_selection_start_time, f_scor_desc, f_update_time from f_pro_beh_infor_browse
    </sql>

    <select id="selectFProBehInforBrowseList" parameterType="FProBehInforBrowse" resultMap="FProBehInforBrowseResult">
        <include refid="selectFProBehInforBrowseVo"/>
        <where>  
            <if test="fIdNo != null  and fIdNo != ''"> and f_id_no like concat('%', #{fIdNo}, '%')</if>
        </where>
        ORDER BY f_update_time DESC
    </select>
    
    <select id="selectFProBehInforBrowseById" parameterType="Long" resultMap="FProBehInforBrowseResult">
        <include refid="selectFProBehInforBrowseVo"/>
        where f_pro_beh_infor_id = #{fProBehInforId}
    </select>
        
    <insert id="insertFProBehInforBrowse" parameterType="FProBehInforBrowse" useGeneratedKeys="true" keyProperty="fProBehInforId">
        insert into f_pro_beh_infor_browse
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fIdNo != null and fIdNo != ''">f_id_no,</if>
            <if test="fExperEval != null and fExperEval != ''">f_exper_eval,</if>
            <if test="fSelectionEvent != null">f_selection_event,</if>
            <if test="fSelectionStartTime != null">f_selection_start_time,</if>
            <if test="fScorDesc != null">f_scor_desc,</if>
            <if test="fUpdateTime != null">f_update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fIdNo != null and fIdNo != ''">#{fIdNo},</if>
            <if test="fExperEval != null and fExperEval != ''">#{fExperEval},</if>
            <if test="fSelectionEvent != null">#{fSelectionEvent},</if>
            <if test="fSelectionStartTime != null">#{fSelectionStartTime},</if>
            <if test="fScorDesc != null">#{fScorDesc},</if>
            <if test="fUpdateTime != null">#{fUpdateTime},</if>
         </trim>
    </insert>

    <update id="updateFProBehInforBrowse" parameterType="FProBehInforBrowse">
        update f_pro_beh_infor_browse
        <trim prefix="SET" suffixOverrides=",">
            <if test="fIdNo != null and fIdNo != ''">f_id_no = #{fIdNo},</if>
            <if test="fExperEval != null and fExperEval != ''">f_exper_eval = #{fExperEval},</if>
            <if test="fSelectionEvent != null">f_selection_event = #{fSelectionEvent},</if>
            <if test="fSelectionStartTime != null">f_selection_start_time = #{fSelectionStartTime},</if>
            <if test="fScorDesc != null">f_scor_desc = #{fScorDesc},</if>
            <if test="fUpdateTime != null">f_update_time = #{fUpdateTime},</if>
        </trim>
        where f_pro_beh_infor_id = #{fProBehInforId}
    </update>

    <delete id="deleteFProBehInforBrowseById" parameterType="Long">
        delete from f_pro_beh_infor_browse where f_pro_beh_infor_id = #{fProBehInforId}
    </delete>

    <delete id="deleteFProBehInforBrowseByIds" parameterType="String">
        delete from f_pro_beh_infor_browse where f_pro_beh_infor_id in 
        <foreach item="fProBehInforId" collection="array" open="(" separator="," close=")">
            #{fProBehInforId}
        </foreach>
    </delete>

    <insert id="batchInsertFProBehInforBrowse" parameterType="FProBehInforBrowse" useGeneratedKeys="true" keyProperty="fProBehInforId">
        insert into f_pro_beh_infor_browse(
            f_id_no,
            f_exper_eval,
            f_selection_event,
            f_selection_start_time,
            f_scor_desc,
            f_update_time
        )VALUES
        <foreach collection="list" separator="," item="item">
            (
                #{item.fIdNo},
                #{item.fExperEval},
                #{item.fSelectionEvent},
                #{item.fSelectionStartTime},
                #{item.fScorDesc},
                #{item.fUpdateTime}
            )
        </foreach>
    </insert>
</mapper>