<?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.ObjTtsaExamApplMapper">
    <resultMap type="com.goldenwater.slaj.ttsa.domain.ObjTtsaExamAppl" id="ObjTtsaExamApplResult">
        <result property="guid" column="guid"/>
        <result property="applOrgGuid" column="appl_org_guid"/>
        <result property="applTime" column="appl_time"/>
        <result property="applType" column="appl_type"/>
        <result property="applExamType" column="appl_exam_type"/>
        <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="selectObjTtsaExamApplVo">
        select guid, appl_org_guid, appl_time, appl_type, appl_exam_type,
               note, coll_time, upd_time, rec_pers
        from obj_ttsa_exam_appl
    </sql>

    <select id="selectObjTtsaExamApplByGuid" parameterType="String" resultMap="ObjTtsaExamApplResult">
        <include refid="selectObjTtsaExamApplVo"/> where guid = #{guid}
    </select>

    <select id="selectObjTtsaExamApplList" parameterType="com.goldenwater.slaj.ttsa.domain.ObjTtsaExamAppl" resultMap="ObjTtsaExamApplResult">
        <include refid="selectObjTtsaExamApplVo"/>
        <where>
            <if test="applOrgGuid != null and applOrgGuid != ''">and appl_org_guid = #{applOrgGuid}</if>
            <if test="applType != null and applType != ''">and appl_type = #{applType}</if>
            <if test="applExamType != null and applExamType != ''">and appl_exam_type = #{applExamType}</if>
        </where>
    </select>

    <insert id="insertObjTtsaExamAppl" parameterType="com.goldenwater.slaj.ttsa.domain.ObjTtsaExamAppl">
        insert into obj_ttsa_exam_appl (
            guid, appl_org_guid, appl_time, appl_type, appl_exam_type,
            note, coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{applOrgGuid}, #{applTime}, #{applType}, #{applExamType},
            #{note}, #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateObjTtsaExamAppl" parameterType="com.goldenwater.slaj.ttsa.domain.ObjTtsaExamAppl">
        update obj_ttsa_exam_appl
        <set>
            <if test="applOrgGuid != null">appl_org_guid = #{applOrgGuid},</if>
            <if test="applTime != null">appl_time = #{applTime},</if>
            <if test="applType != null">appl_type = #{applType},</if>
            <if test="applExamType != null">appl_exam_type = #{applExamType},</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="deleteObjTtsaExamApplByGuid" parameterType="String">
        delete from obj_ttsa_exam_appl where guid = #{guid}
    </delete>

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