<?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.BisStanCertRevMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.BisStanCertRev" id="BisStanCertRevResult">
        <result property="guid" column="guid"/>
        <result property="stanCertGuid" column="stan_cert_guid"/>
        <result property="revReas" column="rev_reas"/>
        <result property="revTime" column="rev_time"/>
        <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="selectBisStanCertRevVo">
        select guid, stan_cert_guid, rev_reas, rev_time, note,
               coll_time, upd_time, rec_pers
        from bis_stan_cert_rev
    </sql>

    <select id="selectBisStanCertRevByGuid" parameterType="String" resultMap="BisStanCertRevResult">
        <include refid="selectBisStanCertRevVo"/> where guid = #{guid}
    </select>

    <select id="selectBisStanCertRevList" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertRev" resultMap="BisStanCertRevResult">
        <include refid="selectBisStanCertRevVo"/>
        <where>
            <if test="stanCertGuid != null and stanCertGuid != ''">and stan_cert_guid = #{stanCertGuid}</if>
        </where>
    </select>

    <insert id="insertBisStanCertRev" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertRev">
        insert into bis_stan_cert_rev (
            guid, stan_cert_guid, rev_reas, rev_time, note,
            coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{stanCertGuid}, #{revReas}, #{revTime}, #{note},
            #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisStanCertRev" parameterType="com.goldenwater.slaj.stan.domain.BisStanCertRev">
        update bis_stan_cert_rev
        <set>
            <if test="stanCertGuid != null">stan_cert_guid = #{stanCertGuid},</if>
            <if test="revReas != null">rev_reas = #{revReas},</if>
            <if test="revTime != null">rev_time = #{revTime},</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="deleteBisStanCertRevByGuid" parameterType="String">
        delete from bis_stan_cert_rev where guid = #{guid}
    </delete>

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