<?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.BisStanCertMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.BisStanCert" id="BisStanCertResult">
        <result property="guid" column="guid"/>
        <result property="stanCertCode" column="stan_cert_code"/>
        <result property="stanReviGuid" column="stan_revi_guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="stanGrad" column="stan_grad"/>
        <result property="issueTime" column="issue_time"/>
        <result property="certExpiTime" column="cert_expi_time"/>
        <result property="issueWiunCode" column="issue_wiun_code"/>
        <result property="certStat" column="cert_stat"/>
        <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="selectBisStanCertVo">
        select guid, stan_cert_code, stan_revi_guid, org_guid, stan_grad,
               issue_time, cert_expi_time, issue_wiun_code, cert_stat, note,
               coll_time, upd_time, rec_pers
        from bis_stan_cert
    </sql>

    <select id="selectBisStanCertByGuid" parameterType="String" resultMap="BisStanCertResult">
        <include refid="selectBisStanCertVo"/> where guid = #{guid}
    </select>

    <select id="selectBisStanCertList" parameterType="com.goldenwater.slaj.stan.domain.BisStanCert" resultMap="BisStanCertResult">
        <include refid="selectBisStanCertVo"/>
        <where>
            <if test="stanCertCode != null and stanCertCode != ''">and stan_cert_code = #{stanCertCode}</if>
            <if test="stanGrad != null and stanGrad != ''">and stan_grad = #{stanGrad}</if>
            <if test="certStat != null and certStat != ''">and cert_stat = #{certStat}</if>
            <if test="orgGuid != null and orgGuid != ''">and org_guid = #{orgGuid}</if>
        </where>
    </select>

    <insert id="insertBisStanCert" parameterType="com.goldenwater.slaj.stan.domain.BisStanCert">
        insert into bis_stan_cert (
            guid, stan_cert_code, stan_revi_guid, org_guid, stan_grad,
            issue_time, cert_expi_time, issue_wiun_code, cert_stat, note,
            coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{stanCertCode}, #{stanReviGuid}, #{orgGuid}, #{stanGrad},
            #{issueTime}, #{certExpiTime}, #{issueWiunCode}, #{certStat}, #{note},
            #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisStanCert" parameterType="com.goldenwater.slaj.stan.domain.BisStanCert">
        update bis_stan_cert
        <set>
            <if test="stanCertCode != null">stan_cert_code = #{stanCertCode},</if>
            <if test="stanReviGuid != null">stan_revi_guid = #{stanReviGuid},</if>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="stanGrad != null">stan_grad = #{stanGrad},</if>
            <if test="issueTime != null">issue_time = #{issueTime},</if>
            <if test="certExpiTime != null">cert_expi_time = #{certExpiTime},</if>
            <if test="issueWiunCode != null">issue_wiun_code = #{issueWiunCode},</if>
            <if test="certStat != null">cert_stat = #{certStat},</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="deleteBisStanCertByGuid" parameterType="String">
        delete from bis_stan_cert where guid = #{guid}
    </delete>

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