<?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.eutr.mapper.BisEutrPlanMapper">
    <resultMap type="com.goldenwater.slaj.eutr.domain.BisEutrPlan" id="BisEutrPlanResult">
        <result property="guid" column="guid"/>
        <result property="planOrgGuid" column="plan_org_guid"/>
        <result property="eutrPlanTitle" column="eutr_plan_title"/>
        <result property="planExecDate" column="plan_exec_date"/>
        <result property="planPersCount" column="plan_pers_count"/>
        <result property="planTotalHours" column="plan_total_hours"/>
        <result property="estaPers" column="esta_pers"/>
        <result property="estaTime" column="esta_time"/>
        <result property="repStat" column="rep_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="selectBisEutrPlanVo">
        select guid, plan_org_guid, eutr_plan_title, plan_exec_date, plan_pers_count,
               plan_total_hours, esta_pers, esta_time, rep_stat, note,
               coll_time, upd_time, rec_pers
        from bis_eutr_plan
    </sql>
    <select id="selectBisEutrPlanByGuid" parameterType="String" resultMap="BisEutrPlanResult">
        <include refid="selectBisEutrPlanVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBisEutrPlanList" parameterType="com.goldenwater.slaj.eutr.domain.BisEutrPlan" resultMap="BisEutrPlanResult">
        <include refid="selectBisEutrPlanVo"/>
        <where>
            <if test="eutrPlanTitle != null and eutrPlanTitle != ''">AND eutr_plan_title like '%' || #{eutrPlanTitle} || '%'</if>
            <if test="repStat != null and repStat != ''">AND rep_stat = #{repStat}</if>
        </where>
    </select>
    <insert id="insertBisEutrPlan" parameterType="com.goldenwater.slaj.eutr.domain.BisEutrPlan">
        insert into bis_eutr_plan (
            guid, plan_org_guid, eutr_plan_title, plan_exec_date, plan_pers_count,
            plan_total_hours, esta_pers, esta_time, rep_stat, note,
            coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{planOrgGuid}, #{eutrPlanTitle}, #{planExecDate}, #{planPersCount},
            #{planTotalHours}, #{estaPers}, #{estaTime}, #{repStat}, #{note},
            #{collTime}, #{updTime}, #{recPers}
        )
    </insert>
    <update id="updateBisEutrPlan" parameterType="com.goldenwater.slaj.eutr.domain.BisEutrPlan">
        update bis_eutr_plan
        <set>
            <if test="planOrgGuid != null">plan_org_guid = #{planOrgGuid},</if>
            <if test="eutrPlanTitle != null">eutr_plan_title = #{eutrPlanTitle},</if>
            <if test="planExecDate != null">plan_exec_date = #{planExecDate},</if>
            <if test="planPersCount != null">plan_pers_count = #{planPersCount},</if>
            <if test="planTotalHours != null">plan_total_hours = #{planTotalHours},</if>
            <if test="estaPers != null">esta_pers = #{estaPers},</if>
            <if test="estaTime != null">esta_time = #{estaTime},</if>
            <if test="repStat != null">rep_stat = #{repStat},</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="deleteBisEutrPlanByGuid" parameterType="String">
        delete from bis_eutr_plan where guid = #{guid}
    </delete>
    <delete id="deleteBisEutrPlanByGuids" parameterType="String">
        delete from bis_eutr_plan where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
