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

    <resultMap type="RecordGroupamountDay" id="RecordGroupamountDayResult">
        <result property="objid"    column="objid"    />
        <result property="groupid"    column="groupid"    />
        <result property="groupname"    column="groupname"    />
        <result property="realAmount"    column="real_amount"    />
        <result property="unitId"    column="unit_id"    />
        <result property="recordtime"    column="recordtime"    />
    </resultMap>

    <sql id="selectRecordGroupamountDayVo">
        select objid, groupid, groupname, real_amount, unit_id, recordtime from record_groupamount_day
    </sql>

    <select id="selectRecordGroupamountDayList" parameterType="RecordGroupamountDay" resultMap="RecordGroupamountDayResult">
        <include refid="selectRecordGroupamountDayVo"/>
        <where>
            <if test="groupid != null  and groupid != ''"> and groupid = #{groupid}</if>
            <if test="groupname != null  and groupname != ''"> and groupname like ('%' + #{groupname} + '%')</if>
            <if test="recordtime != null "> and recordtime = #{recordtime}</if>
        </where>
    </select>

    <select id="selectRecordGroupamountDayById" parameterType="Long" resultMap="RecordGroupamountDayResult">
        <include refid="selectRecordGroupamountDayVo"/>
        where objid = #{objid}
    </select>

    <insert id="insertRecordGroupamountDay" parameterType="RecordGroupamountDay">
        insert into record_groupamount_day
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objid != null">objid,</if>
            <if test="groupid != null">groupid,</if>
            <if test="groupname != null">groupname,</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="groupid != null">#{groupid},</if>
            <if test="groupname != null">#{groupname},</if>
            <if test="realAmount != null">#{realAmount},</if>
            <if test="unitId != null">#{unitId},</if>
            <if test="recordtime != null">#{recordtime},</if>
         </trim>
    </insert>

    <update id="updateRecordGroupamountDay" parameterType="RecordGroupamountDay">
        update record_groupamount_day
        <trim prefix="SET" suffixOverrides=",">
            <if test="groupid != null">groupid = #{groupid},</if>
            <if test="groupname != null">groupname = #{groupname},</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="deleteRecordGroupamountDayById" parameterType="Long">
        delete from record_groupamount_day where objid = #{objid}
    </delete>

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

</mapper>
