<?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.BisTtsaRecMapper">
    <resultMap type="com.goldenwater.slaj.ttsa.domain.BisTtsaRec" id="BisTtsaRecResult">
        <result property="guid" column="guid"/>
        <result property="ttsaGuid" column="ttsa_guid"/>
        <result property="persTtsGuid" column="pers_tts_guid"/>
        <result property="examGuid" column="exam_guid"/>
        <result property="ttsaType" column="ttsa_type"/>
        <result property="ttsaScore" column="ttsa_score"/>
        <result property="assResu" column="ass_resu"/>
        <result property="recDate" column="rec_date"/>
        <result property="orgGuid" column="org_guid"/>
        <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="selectBisTtsaRecVo">
        select guid, ttsa_guid, pers_tts_guid, exam_guid, ttsa_type,
               ttsa_score, ass_resu, rec_date, org_guid, note,
               coll_time, upd_time, rec_pers
        from bis_ttsa_rec
    </sql>

    <select id="selectBisTtsaRecByGuid" parameterType="String" resultMap="BisTtsaRecResult">
        <include refid="selectBisTtsaRecVo"/> where guid = #{guid}
    </select>

    <select id="selectBisTtsaRecList" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaRec" resultMap="BisTtsaRecResult">
        <include refid="selectBisTtsaRecVo"/>
        <where>
            <if test="ttsaGuid != null and ttsaGuid != ''">and ttsa_guid = #{ttsaGuid}</if>
            <if test="ttsaType != null and ttsaType != ''">and ttsa_type = #{ttsaType}</if>
            <if test="assResu != null and assResu != ''">and ass_resu = #{assResu}</if>
        </where>
    </select>

    <insert id="insertBisTtsaRec" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaRec">
        insert into bis_ttsa_rec (
            guid, ttsa_guid, pers_tts_guid, exam_guid, ttsa_type,
            ttsa_score, ass_resu, rec_date, org_guid, note,
            coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{ttsaGuid}, #{persTtsGuid}, #{examGuid}, #{ttsaType},
            #{ttsaScore}, #{assResu}, #{recDate}, #{orgGuid}, #{note},
            #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisTtsaRec" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaRec">
        update bis_ttsa_rec
        <set>
            <if test="ttsaGuid != null">ttsa_guid = #{ttsaGuid},</if>
            <if test="persTtsGuid != null">pers_tts_guid = #{persTtsGuid},</if>
            <if test="examGuid != null">exam_guid = #{examGuid},</if>
            <if test="ttsaType != null">ttsa_type = #{ttsaType},</if>
            <if test="ttsaScore != null">ttsa_score = #{ttsaScore},</if>
            <if test="assResu != null">ass_resu = #{assResu},</if>
            <if test="recDate != null">rec_date = #{recDate},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</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="deleteBisTtsaRecByGuid" parameterType="String">
        delete from bis_ttsa_rec where guid = #{guid}
    </delete>

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