<?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.RecordWorkprocedureamountDayMapper">

    <resultMap type="RecordWorkprocedureamountDay" id="RecordWorkprocedureamountDayResult">
        <result property="objid"    column="objid"    />
        <result property="workingProcedureId"    column="working_procedure_id"    />
        <result property="workingProcedureName"    column="working_procedure_name"    />
        <result property="realAmount"    column="real_amount"    />
        <result property="unitId"    column="unit_id"    />
        <result property="recordtime"    column="recordtime"    />
    </resultMap>

    <sql id="selectRecordWorkprocedureamountDayVo">
        select objid, working_procedure_id, working_procedure_name, real_amount, unit_id, recordtime from record_workprocedureamount_day
    </sql>

    <select id="selectRecordWorkprocedureamountDayList" parameterType="RecordWorkprocedureamountDay" resultMap="RecordWorkprocedureamountDayResult">
        <include refid="selectRecordWorkprocedureamountDayVo"/>
        <where>
            <if test="workingProcedureId != null  and workingProcedureId != ''"> and working_procedure_id = #{workingProcedureId}</if>
            <if test="workingProcedureName != null  and workingProcedureName != ''"> and working_procedure_name like ('%' + #{workingProcedureName} + '%')</if>
            <if test="recordtime != null "> and recordtime = #{recordtime}</if>
        </where>
    </select>

    <select id="selectRecordWorkprocedureamountDayById" parameterType="Long" resultMap="RecordWorkprocedureamountDayResult">
        <include refid="selectRecordWorkprocedureamountDayVo"/>
        where objid = #{objid}
    </select>

    <insert id="insertRecordWorkprocedureamountDay" parameterType="RecordWorkprocedureamountDay">
        insert into record_workprocedureamount_day
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objid != null">objid,</if>
            <if test="workingProcedureId != null">working_procedure_id,</if>
            <if test="workingProcedureName != null">working_procedure_name,</if>
            <if test="realAmount != null">real_amount,</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="workingProcedureId != null">#{workingProcedureId},</if>
            <if test="workingProcedureName != null">#{workingProcedureName},</if>
            <if test="realAmount != null">#{realAmount},</if>
            <if test="unitId != null">#{unitId},</if>
            <if test="recordtime != null">#{recordtime},</if>
         </trim>
    </insert>

    <update id="updateRecordWorkprocedureamountDay" parameterType="RecordWorkprocedureamountDay">
        update record_workprocedureamount_day
        <trim prefix="SET" suffixOverrides=",">
            <if test="workingProcedureId != null">working_procedure_id = #{workingProcedureId},</if>
            <if test="workingProcedureName != null">working_procedure_name = #{workingProcedureName},</if>
            <if test="realAmount != null">real_amount = #{realAmount},</if>
            <if test="unitId != null">unit_id = #{unitId},</if>
            <if test="recordtime != null">recordtime = #{recordtime},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteRecordWorkprocedureamountDayById" parameterType="Long">
        delete from record_workprocedureamount_day where objid = #{objid}
    </delete>

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

</mapper>
