<?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.goldenwater.slaj.ttsa.mapper.BisTtsaExamEnteMapper">
    <resultMap type="com.goldenwater.slaj.ttsa.domain.BisTtsaExamEnte" id="BisTtsaExamEnteResult">
        <result property="guid" column="guid"/>
        <result property="planGuid" column="plan_guid"/>
        <result property="enteWiumGuid" column="ente_wium_guid"/>
        <result property="enteTime" column="ente_time"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
    </resultMap>

    <sql id="selectBisTtsaExamEnteVo">
        select guid, plan_guid, ente_wium_guid, ente_time, note,
               coll_time, upd_time, rec_pers
        from bis_ttsa_exam_ente
    </sql>

    <select id="selectBisTtsaExamEnteByGuid" parameterType="String" resultMap="BisTtsaExamEnteResult">
        <include refid="selectBisTtsaExamEnteVo"/> where guid = #{guid}
    </select>

    <select id="selectBisTtsaExamEnteList" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaExamEnte" resultMap="BisTtsaExamEnteResult">
        <include refid="selectBisTtsaExamEnteVo"/>
        <where>
            <if test="planGuid != null and planGuid != ''">and plan_guid = #{planGuid}</if>
            <if test="enteWiumGuid != null and enteWiumGuid != ''">and ente_wium_guid = #{enteWiumGuid}</if>
        </where>
    </select>

    <insert id="insertBisTtsaExamEnte" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaExamEnte">
        insert into bis_ttsa_exam_ente (
            guid, plan_guid, ente_wium_guid, ente_time, note,
            coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{planGuid}, #{enteWiumGuid}, #{enteTime}, #{note},
            #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisTtsaExamEnte" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaExamEnte">
        update bis_ttsa_exam_ente
        <set>
            <if test="planGuid != null">plan_guid = #{planGuid},</if>
            <if test="enteWiumGuid != null">ente_wium_guid = #{enteWiumGuid},</if>
            <if test="enteTime != null">ente_time = #{enteTime},</if>
            <if test="note != null">note = #{note},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisTtsaExamEnteByGuid" parameterType="String">
        delete from bis_ttsa_exam_ente where guid = #{guid}
    </delete>

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