<?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.BisTtsaCertChaApplMapper">
    <resultMap type="com.goldenwater.slaj.ttsa.domain.BisTtsaCertChaAppl" id="BisTtsaCertChaApplResult">
        <result property="guid" column="guid"/>
        <result property="ttsaCertGuid" column="ttsa_cert_guid"/>
        <result property="applOrgGuid" column="appl_org_guid"/>
        <result property="certCode" column="cert_code"/>
        <result property="chanType" column="chan_type"/>
        <result property="apllTime" column="apll_time"/>
        <result property="veriTime" column="veri_time"/>
        <result property="veriPers" column="veri_pers"/>
        <result property="veriIfAgree" column="veri_if_agree"/>
        <result property="wiunOpin" column="wiun_opin"/>
        <result property="apprTime" column="appr_time"/>
        <result property="apprPers" column="appr_pers"/>
        <result property="apprIfAgree" column="appr_if_agree"/>
        <result property="apprWiunOpin" column="appr_wiun_opin"/>
        <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="punoGuid" column="puno_guid"/>
        <result property="ifRepAppr" column="if_rep_appr"/>
        <result property="ifVeriAppr" column="if_veri_appr"/>
        <result property="ifWater" column="if_water"/>
    </resultMap>

    <sql id="selectBisTtsaCertChaApplVo">
        select guid, ttsa_cert_guid, appl_org_guid, cert_code, chan_type,
               apll_time, veri_time, veri_pers, veri_if_agree, wiun_opin,
               appr_time, appr_pers, appr_if_agree, appr_wiun_opin, note,
               coll_time, upd_time, rec_pers, puno_guid, if_rep_appr,
               if_veri_appr, if_water
        from bis_ttsa_cert_cha_appl
    </sql>

    <select id="selectBisTtsaCertChaApplByGuid" parameterType="String" resultMap="BisTtsaCertChaApplResult">
        <include refid="selectBisTtsaCertChaApplVo"/> where guid = #{guid}
    </select>

    <select id="selectBisTtsaCertChaApplList" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaCertChaAppl" resultMap="BisTtsaCertChaApplResult">
        <include refid="selectBisTtsaCertChaApplVo"/>
        <where>
            <if test="ttsaCertGuid != null and ttsaCertGuid != ''">and ttsa_cert_guid = #{ttsaCertGuid}</if>
            <if test="chanType != null and chanType != ''">and chan_type = #{chanType}</if>
            <if test="veriIfAgree != null and veriIfAgree != ''">and veri_if_agree = #{veriIfAgree}</if>
        </where>
    </select>

    <insert id="insertBisTtsaCertChaAppl" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaCertChaAppl">
        insert into bis_ttsa_cert_cha_appl (
            guid, ttsa_cert_guid, appl_org_guid, cert_code, chan_type,
            apll_time, veri_time, veri_pers, veri_if_agree, wiun_opin,
            appr_time, appr_pers, appr_if_agree, appr_wiun_opin, note,
            coll_time, upd_time, rec_pers, puno_guid, if_rep_appr,
            if_veri_appr, if_water
        ) values (
            #{guid}, #{ttsaCertGuid}, #{applOrgGuid}, #{certCode}, #{chanType},
            #{apllTime}, #{veriTime}, #{veriPers}, #{veriIfAgree}, #{wiunOpin},
            #{apprTime}, #{apprPers}, #{apprIfAgree}, #{apprWiunOpin}, #{note},
            #{collTime}, #{updTime}, #{recPers}, #{punoGuid}, #{ifRepAppr},
            #{ifVeriAppr}, #{ifWater}
        )
    </insert>

    <update id="updateBisTtsaCertChaAppl" parameterType="com.goldenwater.slaj.ttsa.domain.BisTtsaCertChaAppl">
        update bis_ttsa_cert_cha_appl
        <set>
            <if test="ttsaCertGuid != null">ttsa_cert_guid = #{ttsaCertGuid},</if>
            <if test="applOrgGuid != null">appl_org_guid = #{applOrgGuid},</if>
            <if test="certCode != null">cert_code = #{certCode},</if>
            <if test="chanType != null">chan_type = #{chanType},</if>
            <if test="apllTime != null">apll_time = #{apllTime},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="veriPers != null">veri_pers = #{veriPers},</if>
            <if test="veriIfAgree != null">veri_if_agree = #{veriIfAgree},</if>
            <if test="wiunOpin != null">wiun_opin = #{wiunOpin},</if>
            <if test="apprTime != null">appr_time = #{apprTime},</if>
            <if test="apprPers != null">appr_pers = #{apprPers},</if>
            <if test="apprIfAgree != null">appr_if_agree = #{apprIfAgree},</if>
            <if test="apprWiunOpin != null">appr_wiun_opin = #{apprWiunOpin},</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="punoGuid != null">puno_guid = #{punoGuid},</if>
            <if test="ifRepAppr != null">if_rep_appr = #{ifRepAppr},</if>
            <if test="ifVeriAppr != null">if_veri_appr = #{ifVeriAppr},</if>
            <if test="ifWater != null">if_water = #{ifWater},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisTtsaCertChaApplByGuid" parameterType="String">
        delete from bis_ttsa_cert_cha_appl where guid = #{guid}
    </delete>

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