<?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.eme.mapper.BusiPlanCountMapper">
    <resultMap type="com.goldenwater.slaj.eme.domain.BusiPlanCount" id="BusiPlanCountResult">
        <result property="guid" column="guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="createTime" column="create_time"/>
        <result property="zhPlan" column="zh_plan"/>
        <result property="zxPlan" column="zx_plan"/>
        <result property="xcPlan" column="xc_plan"/>
        <result property="orgNum" column="org_num"/>
        <result property="reportPlanOrg" column="report_plan_org"/>
        <result property="orgPlanRa" column="org_plan_ra"/>
        <result property="drillNum" column="drill_num"/>
        <result property="planDrillRa" column="plan_drill_ra"/>
    </resultMap>
    <sql id="selectBusiPlanCountVo">
        select guid, org_guid, create_time, zh_plan, zx_plan, xc_plan,
               org_num, report_plan_org, org_plan_ra, drill_num, plan_drill_ra
        from t_busi_plan_count
    </sql>
    <select id="selectBusiPlanCountByGuid" parameterType="String" resultMap="BusiPlanCountResult">
        <include refid="selectBusiPlanCountVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBusiPlanCountList" parameterType="com.goldenwater.slaj.eme.domain.BusiPlanCount" resultMap="BusiPlanCountResult">
        <include refid="selectBusiPlanCountVo"/>
        <where>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
        </where>
    </select>
    <insert id="insertBusiPlanCount" parameterType="com.goldenwater.slaj.eme.domain.BusiPlanCount">
        insert into t_busi_plan_count (
            guid, org_guid, create_time, zh_plan, zx_plan, xc_plan,
            org_num, report_plan_org, org_plan_ra, drill_num, plan_drill_ra
        ) values (
            #{guid}, #{orgGuid}, #{createTime}, #{zhPlan}, #{zxPlan}, #{xcPlan},
            #{orgNum}, #{reportPlanOrg}, #{orgPlanRa}, #{drillNum}, #{planDrillRa}
        )
    </insert>
    <update id="updateBusiPlanCount" parameterType="com.goldenwater.slaj.eme.domain.BusiPlanCount">
        update t_busi_plan_count
        <set>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="zhPlan != null">zh_plan = #{zhPlan},</if>
            <if test="zxPlan != null">zx_plan = #{zxPlan},</if>
            <if test="xcPlan != null">xc_plan = #{xcPlan},</if>
            <if test="orgNum != null">org_num = #{orgNum},</if>
            <if test="reportPlanOrg != null">report_plan_org = #{reportPlanOrg},</if>
            <if test="orgPlanRa != null">org_plan_ra = #{orgPlanRa},</if>
            <if test="drillNum != null">drill_num = #{drillNum},</if>
            <if test="planDrillRa != null">plan_drill_ra = #{planDrillRa},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteBusiPlanCountByGuid" parameterType="String">
        delete from t_busi_plan_count where guid = #{guid}
    </delete>
    <delete id="deleteBusiPlanCountByGuids" parameterType="String">
        delete from t_busi_plan_count where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
