<?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.ObjStanReviMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.ObjStanRevi" id="ObjStanReviResult">
        <result property="guid" column="guid"/>
        <result property="applOrgGuid" column="appl_org_guid"/>
        <result property="applProp" column="appl_prop"/>
        <result property="applGrade" column="appl_grade"/>
        <result property="befoStanSitu" column="befo_stan_situ"/>
        <result property="selfEvaConc" column="self_eva_conc"/>
        <result property="applTime" column="appl_time"/>
        <result property="veriWiunCode" column="veri_wiun_code"/>
        <result property="veriTime" column="veri_time"/>
        <result property="veriOpin" column="veri_opin"/>
        <result property="veriConc" column="veri_conc"/>
        <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="selectObjStanReviVo">
        select guid, appl_org_guid, appl_prop, appl_grade, befo_stan_situ,
               self_eva_conc, appl_time, veri_wiun_code, veri_time, veri_opin,
               veri_conc, note, coll_time, upd_time, rec_pers
        from obj_stan_revi
    </sql>

    <select id="selectObjStanReviByGuid" parameterType="String" resultMap="ObjStanReviResult">
        <include refid="selectObjStanReviVo"/> where guid = #{guid}
    </select>

    <select id="selectObjStanReviList" parameterType="com.goldenwater.slaj.stan.domain.ObjStanRevi" resultMap="ObjStanReviResult">
        <include refid="selectObjStanReviVo"/>
        <where>
            <if test="applOrgGuid != null and applOrgGuid != ''">and appl_org_guid = #{applOrgGuid}</if>
            <if test="veriConc != null and veriConc != ''">and veri_conc = #{veriConc}</if>
            <if test="applGrade != null and applGrade != ''">and appl_grade = #{applGrade}</if>
        </where>
    </select>

    <insert id="insertObjStanRevi" parameterType="com.goldenwater.slaj.stan.domain.ObjStanRevi">
        insert into obj_stan_revi (
            guid, appl_org_guid, appl_prop, appl_grade, befo_stan_situ,
            self_eva_conc, appl_time, veri_wiun_code, veri_time, veri_opin,
            veri_conc, note, coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{applOrgGuid}, #{applProp}, #{applGrade}, #{befoStanSitu},
            #{selfEvaConc}, #{applTime}, #{veriWiunCode}, #{veriTime}, #{veriOpin},
            #{veriConc}, #{note}, #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateObjStanRevi" parameterType="com.goldenwater.slaj.stan.domain.ObjStanRevi">
        update obj_stan_revi
        <set>
            <if test="applOrgGuid != null">appl_org_guid = #{applOrgGuid},</if>
            <if test="applProp != null">appl_prop = #{applProp},</if>
            <if test="applGrade != null">appl_grade = #{applGrade},</if>
            <if test="befoStanSitu != null">befo_stan_situ = #{befoStanSitu},</if>
            <if test="selfEvaConc != null">self_eva_conc = #{selfEvaConc},</if>
            <if test="applTime != null">appl_time = #{applTime},</if>
            <if test="veriWiunCode != null">veri_wiun_code = #{veriWiunCode},</if>
            <if test="veriTime != null">veri_time = #{veriTime},</if>
            <if test="veriOpin != null">veri_opin = #{veriOpin},</if>
            <if test="veriConc != null">veri_conc = #{veriConc},</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="deleteObjStanReviByGuid" parameterType="String">
        delete from obj_stan_revi where guid = #{guid}
    </delete>

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