<?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.ObjPunoMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.ObjPuno" id="ObjPunoResult">
        <result property="guid" column="guid"/>
        <result property="titl" column="titl"/>
        <result property="cont" column="cont"/>
        <result property="punoType" column="puno_type"/>
        <result property="releTime" column="rele_time"/>
        <result property="endTime" column="end_time"/>
        <result property="relePers" column="rele_pers"/>
        <result property="releOrgGuid" column="rele_org_guid"/>
        <result property="valiTime" column="vali_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"/>
        <result property="stanReviGuid" column="stan_revi_guid"/>
        <result property="punoSour" column="puno_sour"/>
    </resultMap>

    <sql id="selectObjPunoVo">
        select guid, titl, cont, puno_type, rele_time, end_time,
               rele_pers, rele_org_guid, vali_time, stat, note,
               coll_time, upd_time, rec_pers, stan_revi_guid, puno_sour
        from obj_puno
    </sql>

    <select id="selectObjPunoByGuid" parameterType="String" resultMap="ObjPunoResult">
        <include refid="selectObjPunoVo"/> where guid = #{guid}
    </select>

    <select id="selectObjPunoList" parameterType="com.goldenwater.slaj.stan.domain.ObjPuno" resultMap="ObjPunoResult">
        <include refid="selectObjPunoVo"/>
        <where>
            <if test="titl != null and titl != ''">and titl like '%' || #{titl} || '%'</if>
            <if test="punoType != null and punoType != ''">and puno_type = #{punoType}</if>
            <if test="stat != null and stat != ''">and stat = #{stat}</if>
        </where>
    </select>

    <insert id="insertObjPuno" parameterType="com.goldenwater.slaj.stan.domain.ObjPuno">
        insert into obj_puno (
            guid, titl, cont, puno_type, rele_time, end_time,
            rele_pers, rele_org_guid, vali_time, stat, note,
            coll_time, upd_time, rec_pers, stan_revi_guid, puno_sour
        ) values (
            #{guid}, #{titl}, #{cont}, #{punoType}, #{releTime}, #{endTime},
            #{relePers}, #{releOrgGuid}, #{valiTime}, #{stat}, #{note},
            #{collTime}, #{updTime}, #{recPers}, #{stanReviGuid}, #{punoSour}
        )
    </insert>

    <update id="updateObjPuno" parameterType="com.goldenwater.slaj.stan.domain.ObjPuno">
        update obj_puno
        <set>
            <if test="titl != null">titl = #{titl},</if>
            <if test="cont != null">cont = #{cont},</if>
            <if test="punoType != null">puno_type = #{punoType},</if>
            <if test="releTime != null">rele_time = #{releTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="relePers != null">rele_pers = #{relePers},</if>
            <if test="releOrgGuid != null">rele_org_guid = #{releOrgGuid},</if>
            <if test="valiTime != null">vali_time = #{valiTime},</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>
            <if test="stanReviGuid != null">stan_revi_guid = #{stanReviGuid},</if>
            <if test="punoSour != null">puno_sour = #{punoSour},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteObjPunoByGuid" parameterType="String">
        delete from obj_puno where guid = #{guid}
    </delete>

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