<?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.BisStanCertChaApplMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.BisStanCertChaAppl" id="BisStanCertChaApplResult">
        <result property="guid" column="guid"/>
        <result property="stanCertGuid" column="stan_cert_guid"/>
        <result property="chanName" column="chan_name"/>
        <result property="applPers" column="appl_pers"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="chanType" column="chan_type"/>
        <result property="riskAna" column="risk_ana"/>
        <result property="contMeas" column="cont_meas"/>
        <result property="apllTime" column="apll_time"/>
        <result property="veriTime" column="veri_time"/>
        <result property="veriPers" column="veri_pers"/>
        <result property="ifAgree" column="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"/>
    </resultMap>

    <sql id="selectBisStanCertChaApplVo">
        select guid, stan_cert_guid, chan_name, appl_pers, org_guid,
               chan_type, risk_ana, cont_meas, apll_time, veri_time,
               veri_pers, if_agree, wiun_opin, appr_time, appr_pers,
               appr_if_agree, appr_wiun_opin, note, coll_time, upd_time, rec_pers
        from bis_stan_cert_cha_appl
    </sql>

    <select id="selectBisStanCertChaApplByGuid" parameterType="String" resultMap="BisStanCertChaApplResult">
        <include refid="selectBisStanCertChaApplVo"/> where guid = #{guid}
    </select>

    <select id="selectBisStanCertChaApplList" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertChaAppl" resultMap="BisStanCertChaApplResult">
        <include refid="selectBisStanCertChaApplVo"/>
        <where>
            <if test="stanCertGuid != null and stanCertGuid != ''">and stan_cert_guid = #{stanCertGuid}</if>
            <if test="chanType != null and chanType != ''">and chan_type = #{chanType}</if>
            <if test="ifAgree != null and ifAgree != ''">and if_agree = #{ifAgree}</if>
        </where>
    </select>

    <insert id="insertBisStanCertChaAppl" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertChaAppl">
        insert into bis_stan_cert_cha_appl (
            guid, stan_cert_guid, chan_name, appl_pers, org_guid,
            chan_type, risk_ana, cont_meas, apll_time, veri_time,
            veri_pers, if_agree, wiun_opin, appr_time, appr_pers,
            appr_if_agree, appr_wiun_opin, note, coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{stanCertGuid}, #{chanName}, #{applPers}, #{orgGuid},
            #{chanType}, #{riskAna}, #{contMeas}, #{apllTime}, #{veriTime},
            #{veriPers}, #{ifAgree}, #{wiunOpin}, #{apprTime}, #{apprPers},
            #{apprIfAgree}, #{apprWiunOpin}, #{note}, #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisStanCertChaAppl" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertChaAppl">
        update bis_stan_cert_cha_appl
        <set>
            <if test="stanCertGuid != null">stan_cert_guid = #{stanCertGuid},</if>
            <if test="chanName != null">chan_name = #{chanName},</if>
            <if test="applPers != null">appl_pers = #{applPers},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="chanType != null">chan_type = #{chanType},</if>
            <if test="riskAna != null">risk_ana = #{riskAna},</if>
            <if test="contMeas != null">cont_meas = #{contMeas},</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="ifAgree != null">if_agree = #{ifAgree},</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>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisStanCertChaApplByGuid" parameterType="String">
        delete from bis_stan_cert_cha_appl where guid = #{guid}
    </delete>

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