<?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.BisTtsaScoreMapper">
    <resultMap type="com.goldenwater.slaj.ttsa.domain.BisTtsaScore" id="BisTtsaScoreResult">
        <result property="guid" column="guid"/>
        <result property="persTtsGuid" column="pers_tts_guid"/>
        <result property="admiTick" column="admi_tick"/>
        <result property="ttsaExamApplGuid" column="ttsa_exam_appl_guid"/>
        <result property="ttsaExamGuid" column="ttsa_exam_guid"/>
        <result property="ttsaType" column="ttsa_type"/>
        <result property="ttsaScore" column="ttsa_score"/>
        <result property="assResu" column="ass_resu"/>
        <result property="veriOrgGuid" column="veri_org_guid"/>
        <result property="veriTime" column="veri_time"/>
        <result property="veriStat" column="veri_stat"/>
        <result property="veriOpin" column="veri_opin"/>
        <result property="apprOrgGuid" column="appr_org_guid"/>
        <result property="apprTime" column="appr_time"/>
        <result property="apprStat" column="appr_stat"/>
        <result property="apprOpin" column="appr_opin"/>
        <result property="punoGuid" column="puno_guid"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
        <result property="examTime" column="exam_time"/>
    </resultMap>

    <sql id="selectBisTtsaScoreVo">
        select guid, pers_tts_guid, admi_tick, ttsa_exam_appl_guid, ttsa_exam_guid,
               ttsa_type, ttsa_score, ass_resu, veri_org_guid, veri_time,
               veri_stat, veri_opin, appr_org_guid, appr_time, appr_stat,
               appr_opin, puno_guid, note, coll_time, upd_time,
               rec_pers, exam_time
        from bis_ttsa_score
    </sql>

    <select id="selectBisTtsaScoreByGuid" parameterType="String" resultMap="BisTtsaScoreResult">
        <include refid="selectBisTtsaScoreVo"/> where guid = #{guid}
    </select>

    <select id="selectBisTtsaScoreList" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaScore" resultMap="BisTtsaScoreResult">
        <include refid="selectBisTtsaScoreVo"/>
        <where>
            <if test="persTtsGuid != null and persTtsGuid != ''">and pers_tts_guid = #{persTtsGuid}</if>
            <if test="ttsaType != null and ttsaType != ''">and ttsa_type = #{ttsaType}</if>
            <if test="assResu != null and assResu != ''">and ass_resu = #{assResu}</if>
            <if test="veriStat != null and veriStat != ''">and veri_stat = #{veriStat}</if>
        </where>
    </select>

    <insert id="insertBisTtsaScore" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaScore">
        insert into bis_ttsa_score (
            guid, pers_tts_guid, admi_tick, ttsa_exam_appl_guid, ttsa_exam_guid,
            ttsa_type, ttsa_score, ass_resu, veri_org_guid, veri_time,
            veri_stat, veri_opin, appr_org_guid, appr_time, appr_stat,
            appr_opin, puno_guid, note, coll_time, upd_time,
            rec_pers, exam_time
        ) values (
            #{guid}, #{persTtsGuid}, #{admiTick}, #{ttsaExamApplGuid}, #{ttsaExamGuid},
            #{ttsaType}, #{ttsaScore}, #{assResu}, #{veriOrgGuid}, #{veriTime},
            #{veriStat}, #{veriOpin}, #{apprOrgGuid}, #{apprTime}, #{apprStat},
            #{apprOpin}, #{punoGuid}, #{note}, #{collTime}, #{updTime},
            #{recPers}, #{examTime}
        )
    </insert>

    <update id="updateBisTtsaScore" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaScore">
        update bis_ttsa_score
        <set>
            <if test="persTtsGuid != null">pers_tts_guid = #{persTtsGuid},</if>
            <if test="admiTick != null">admi_tick = #{admiTick},</if>
            <if test="ttsaExamApplGuid != null">ttsa_exam_appl_guid = #{ttsaExamApplGuid},</if>
            <if test="ttsaExamGuid != null">ttsa_exam_guid = #{ttsaExamGuid},</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="veriOrgGuid != null">veri_org_guid = #{veriOrgGuid},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="veriStat != null">veri_stat = #{veriStat},</if>
            <if test="veriOpin != null">veri_opin = #{veriOpin},</if>
            <if test="apprOrgGuid != null">appr_org_guid = #{apprOrgGuid},</if>
            <if test="apprTime != null">appr_time = #{apprTime},</if>
            <if test="apprStat != null">appr_stat = #{apprStat},</if>
            <if test="apprOpin != null">appr_opin = #{apprOpin},</if>
            <if test="punoGuid != null">puno_guid = #{punoGuid},</if>
            <if test="note != null">note = #{note},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
            <if test="examTime != null">exam_time = #{examTime},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisTtsaScoreByGuid" parameterType="String">
        delete from bis_ttsa_score where guid = #{guid}
    </delete>

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