<?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.BisStanReviRecMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.BisStanReviRec" id="BisStanReviRecResult">
        <result property="guid" column="guid"/>
        <result property="stanReviGuid" column="stan_revi_guid"/>
        <result property="reviWiunCode" column="revi_wiun_code"/>
        <result property="reviType" column="revi_type"/>
        <result property="confTime" column="conf_time"/>
        <result property="confLoc" column="conf_loc"/>
        <result property="partPers" column="part_pers"/>
        <result property="ifSiteRevi" column="if_site_revi"/>
        <result property="startTime" column="start_time"/>
        <result property="endTime" column="end_time"/>
        <result property="reviChief" column="revi_chief"/>
        <result property="reviViceChief" column="revi_vice_chief"/>
        <result property="reviGroupMem" column="revi_group_mem"/>
        <result property="ifAgree" column="if_agree"/>
        <result property="reviOpin" column="revi_opin"/>
        <result property="recomLevel" column="recom_level"/>
        <result property="veriTime" column="veri_time"/>
        <result property="persExpertGuid" column="pers_expert_guid"/>
        <result property="siteReviNote" column="site_revi_note"/>
        <result property="reviNote" column="revi_note"/>
        <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="reviGrade" column="revi_grade"/>
    </resultMap>

    <sql id="selectBisStanReviRecVo">
        select guid, stan_revi_guid, revi_wiun_code, revi_type, conf_time,
               conf_loc, part_pers, if_site_revi, start_time, end_time,
               revi_chief, revi_vice_chief, revi_group_mem, if_agree, revi_opin,
               recom_level, veri_time, pers_expert_guid, site_revi_note, revi_note,
               note, coll_time, upd_time, rec_pers, revi_grade
        from bis_stan_revi_rec
    </sql>

    <select id="selectBisStanReviRecByGuid" parameterType="String" resultMap="BisStanReviRecResult">
        <include refid="selectBisStanReviRecVo"/> where guid = #{guid}
    </select>

    <select id="selectBisStanReviRecList" parameterType="com.goldenwater.slaj.stan.domain.BisStanReviRec" resultMap="BisStanReviRecResult">
        <include refid="selectBisStanReviRecVo"/>
        <where>
            <if test="reviType != null and reviType != ''">and revi_type = #{reviType}</if>
            <if test="ifAgree != null and ifAgree != ''">and if_agree = #{ifAgree}</if>
            <if test="recomLevel != null and recomLevel != ''">and recom_level = #{recomLevel}</if>
        </where>
    </select>

    <insert id="insertBisStanReviRec" parameterType="com.goldenwater.slaj.stan.domain.BisStanReviRec">
        insert into bis_stan_revi_rec (
            guid, stan_revi_guid, revi_wiun_code, revi_type, conf_time,
            conf_loc, part_pers, if_site_revi, start_time, end_time,
            revi_chief, revi_vice_chief, revi_group_mem, if_agree, revi_opin,
            recom_level, veri_time, pers_expert_guid, site_revi_note, revi_note,
            note, coll_time, upd_time, rec_pers, revi_grade
        ) values (
            #{guid}, #{stanReviGuid}, #{reviWiunCode}, #{reviType}, #{confTime},
            #{confLoc}, #{partPers}, #{ifSiteRevi}, #{startTime}, #{endTime},
            #{reviChief}, #{reviViceChief}, #{reviGroupMem}, #{ifAgree}, #{reviOpin},
            #{recomLevel}, #{veriTime}, #{persExpertGuid}, #{siteReviNote}, #{reviNote},
            #{note}, #{collTime}, #{updTime}, #{recPers}, #{reviGrade}
        )
    </insert>

    <update id="updateBisStanReviRec" parameterType="com.goldenwater.slaj.stan.domain.BisStanReviRec">
        update bis_stan_revi_rec
        <set>
            <if test="stanReviGuid != null">stan_revi_guid = #{stanReviGuid},</if>
            <if test="reviWiunCode != null">revi_wiun_code = #{reviWiunCode},</if>
            <if test="reviType != null">revi_type = #{reviType},</if>
            <if test="confTime != null">conf_time = #{confTime},</if>
            <if test="confLoc != null">conf_loc = #{confLoc},</if>
            <if test="partPers != null">part_pers = #{partPers},</if>
            <if test="ifSiteRevi != null">if_site_revi = #{ifSiteRevi},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="reviChief != null">revi_chief = #{reviChief},</if>
            <if test="reviViceChief != null">revi_vice_chief = #{reviViceChief},</if>
            <if test="reviGroupMem != null">revi_group_mem = #{reviGroupMem},</if>
            <if test="ifAgree != null">if_agree = #{ifAgree},</if>
            <if test="reviOpin != null">revi_opin = #{reviOpin},</if>
            <if test="recomLevel != null">recom_level = #{recomLevel},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="persExpertGuid != null">pers_expert_guid = #{persExpertGuid},</if>
            <if test="siteReviNote != null">site_revi_note = #{siteReviNote},</if>
            <if test="reviNote != null">revi_note = #{reviNote},</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="reviGrade != null">revi_grade = #{reviGrade},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisStanReviRecByGuid" parameterType="String">
        delete from bis_stan_revi_rec where guid = #{guid}
    </delete>

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