<?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.ruoyi.report.mapper.RecordPlanrateamountDayMapper">

    <resultMap type="RecordPlanrateamountDay" id="RecordPlanrateamountDayResult">
        <result property="objid"    column="objid"    />
        <result property="planid"    column="planid"    />
        <result property="planAmount"    column="plan_amount"    />
        <result property="realAmount"    column="real_amount"    />
        <result property="plancompleterate"    column="plancompleterate"    />
        <result property="unitId"    column="unit_id"    />
        <result property="recordtime"    column="recordtime"    />
    </resultMap>

    <sql id="selectRecordPlanrateamountDayVo">
        select objid, planid, plan_amount, real_amount, plancompleterate, unit_id, recordtime from record_planrateamount_day
    </sql>

    <select id="selectRecordPlanrateamountDayList" parameterType="RecordPlanrateamountDay" resultMap="RecordPlanrateamountDayResult">
        <include refid="selectRecordPlanrateamountDayVo"/>
        <where>
            <if test="planid != null  and planid != ''"> and planid = #{planid}</if>
            <if test="planAmount != null "> and plan_amount = #{planAmount}</if>
            <if test="realAmount != null "> and real_amount = #{realAmount}</if>
            <if test="recordtime != null "> and recordtime = #{recordtime}</if>
        </where>
    </select>

    <select id="selectRecordPlanrateamountDayById" parameterType="Long" resultMap="RecordPlanrateamountDayResult">
        <include refid="selectRecordPlanrateamountDayVo"/>
        where objid = #{objid}
    </select>

    <insert id="insertRecordPlanrateamountDay" parameterType="RecordPlanrateamountDay">
        insert into record_planrateamount_day
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objid != null">objid,</if>
            <if test="planid != null">planid,</if>
            <if test="planAmount != null">plan_amount,</if>
            <if test="realAmount != null">real_amount,</if>
            <if test="plancompleterate != null">plancompleterate,</if>
            <if test="unitId != null">unit_id,</if>
            <if test="recordtime != null">recordtime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="objid != null">#{objid},</if>
            <if test="planid != null">#{planid},</if>
            <if test="planAmount != null">#{planAmount},</if>
            <if test="realAmount != null">#{realAmount},</if>
            <if test="plancompleterate != null">#{plancompleterate},</if>
            <if test="unitId != null">#{unitId},</if>
            <if test="recordtime != null">#{recordtime},</if>
         </trim>
    </insert>

    <update id="updateRecordPlanrateamountDay" parameterType="RecordPlanrateamountDay">
        update record_planrateamount_day
        <trim prefix="SET" suffixOverrides=",">
            <if test="planid != null">planid = #{planid},</if>
            <if test="planAmount != null">plan_amount = #{planAmount},</if>
            <if test="realAmount != null">real_amount = #{realAmount},</if>
            <if test="plancompleterate != null">plancompleterate = #{plancompleterate},</if>
            <if test="unitId != null">unit_id = #{unitId},</if>
            <if test="recordtime != null">recordtime = #{recordtime},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteRecordPlanrateamountDayById" parameterType="Long">
        delete from record_planrateamount_day where objid = #{objid}
    </delete>

    <delete id="deleteRecordPlanrateamountDayByIds" parameterType="String">
        delete from record_planrateamount_day where objid in
        <foreach item="objid" collection="array" open="(" separator="," close=")">
            #{objid}
        </foreach>
    </delete>

</mapper>
