<?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.stan.mapper.BisStanCertExtApplMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.BisStanCertExtAppl" id="BisStanCertExtApplResult">
        <result property="guid" column="guid"/>
        <result property="stanCertGuid" column="stan_cert_guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="extExp" column="ext_exp"/>
        <result property="apllTime" column="apll_time"/>
        <result property="veriTime" column="veri_time"/>
        <result property="ifAgree" column="if_agree"/>
        <result property="veriWiun" column="veri_wiun"/>
        <result property="apprPers" column="appr_pers"/>
        <result property="apprIfAgree" column="appr_if_agree"/>
        <result property="apprWiun" column="appr_wiun"/>
        <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="selectBisStanCertExtApplVo">
        select guid, stan_cert_guid, org_guid, ext_exp, apll_time, veri_time,
               if_agree, veri_wiun, appr_pers, appr_if_agree, appr_wiun, note,
               coll_time, upd_time, rec_pers
        from bis_stan_cert_ext_appl
    </sql>

    <select id="selectBisStanCertExtApplByGuid" parameterType="String" resultMap="BisStanCertExtApplResult">
        <include refid="selectBisStanCertExtApplVo"/> where guid = #{guid}
    </select>

    <select id="selectBisStanCertExtApplList" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertExtAppl" resultMap="BisStanCertExtApplResult">
        <include refid="selectBisStanCertExtApplVo"/>
        <where>
            <if test="stanCertGuid != null and stanCertGuid != ''">and stan_cert_guid = #{stanCertGuid}</if>
            <if test="ifAgree != null and ifAgree != ''">and if_agree = #{ifAgree}</if>
        </where>
    </select>

    <insert id="insertBisStanCertExtAppl" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertExtAppl">
        insert into bis_stan_cert_ext_appl (
            guid, stan_cert_guid, org_guid, ext_exp, apll_time, veri_time,
            if_agree, veri_wiun, appr_pers, appr_if_agree, appr_wiun, note,
            coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{stanCertGuid}, #{orgGuid}, #{extExp}, #{apllTime}, #{veriTime},
            #{ifAgree}, #{veriWiun}, #{apprPers}, #{apprIfAgree}, #{apprWiun}, #{note},
            #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisStanCertExtAppl" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertExtAppl">
        update bis_stan_cert_ext_appl
        <set>
            <if test="stanCertGuid != null">stan_cert_guid = #{stanCertGuid},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="extExp != null">ext_exp = #{extExp},</if>
            <if test="apllTime != null">apll_time = #{apllTime},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="ifAgree != null">if_agree = #{ifAgree},</if>
            <if test="veriWiun != null">veri_wiun = #{veriWiun},</if>
            <if test="apprPers != null">appr_pers = #{apprPers},</if>
            <if test="apprIfAgree != null">appr_if_agree = #{apprIfAgree},</if>
            <if test="apprWiun != null">appr_wiun = #{apprWiun},</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="deleteBisStanCertExtApplByGuid" parameterType="String">
        delete from bis_stan_cert_ext_appl where guid = #{guid}
    </delete>

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