<?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.ObjStanApplMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.ObjStanAppl" id="ObjStanApplResult">
        <result property="guid" column="guid"/>
        <result property="stanApplCode" column="stan_appl_code"/>
        <result property="applOrgGuid" column="appl_org_guid"/>
        <result property="array" column="array"/>
        <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="stat" column="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="selectObjStanApplVo">
        select guid, stan_appl_code, appl_org_guid, array, appl_prop,
               appl_grade, befo_stan_situ, self_eva_conc, appl_time, stat,
               note, coll_time, upd_time, rec_pers
        from obj_stan_appl
    </sql>

    <select id="selectObjStanApplByGuid" parameterType="String" resultMap="ObjStanApplResult">
        <include refid="selectObjStanApplVo"/> where guid = #{guid}
    </select>

    <select id="selectObjStanApplList" parameterType="com.goldenwater.slaj.stan.domain.ObjStanAppl" resultMap="ObjStanApplResult">
        <include refid="selectObjStanApplVo"/>
        <where>
            <if test="stanApplCode != null and stanApplCode != ''">and stan_appl_code = #{stanApplCode}</if>
            <if test="applOrgGuid != null and applOrgGuid != ''">and appl_org_guid = #{applOrgGuid}</if>
            <if test="stat != null and stat != ''">and stat = #{stat}</if>
            <if test="applGrade != null and applGrade != ''">and appl_grade = #{applGrade}</if>
        </where>
    </select>

    <insert id="insertObjStanAppl" parameterType="com.goldenwater.slaj.stan.domain.ObjStanAppl">
        insert into obj_stan_appl (
            guid, stan_appl_code, appl_org_guid, array, appl_prop,
            appl_grade, befo_stan_situ, self_eva_conc, appl_time, stat,
            note, coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{stanApplCode}, #{applOrgGuid}, #{array}, #{applProp},
            #{applGrade}, #{befoStanSitu}, #{selfEvaConc}, #{applTime}, #{stat},
            #{note}, #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateObjStanAppl" parameterType="com.goldenwater.slaj.stan.domain.ObjStanAppl">
        update obj_stan_appl
        <set>
            <if test="stanApplCode != null">stan_appl_code = #{stanApplCode},</if>
            <if test="applOrgGuid != null">appl_org_guid = #{applOrgGuid},</if>
            <if test="array != null">array = #{array},</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="stat != null">stat = #{stat},</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="deleteObjStanApplByGuid" parameterType="String">
        delete from obj_stan_appl where guid = #{guid}
    </delete>

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