id,
        intake_id,
        dt,
        amount, money, times,
        dt_last,
        rtu_addr_last,
        controller_id_last,
        total_amount_last,
        rtu_dt_last
    
    
    
    
        
        delete
        from rm_intake_amount_day
        where id = #{id,jdbcType=BIGINT}
    
    
        
        insert into rm_intake_amount_day (id, intake_id, dt,
                                          amount, money, times, dt_last,
                                          rtu_addr_last, controller_id_last, total_amount_last,
                                          rtu_dt_last)
        values (#{id,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{dt,jdbcType=DATE},
                #{amount,jdbcType=DOUBLE}, #{money,jdbcType=DOUBLE}, #{times,jdbcType=INTEGER}, #{dtLast,jdbcType=TIMESTAMP},
                #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT},
                #{rtuDtLast,jdbcType=TIMESTAMP})
    
    
        
        insert into rm_intake_amount_day
        
            
                id,
            
            
                intake_id,
            
            
                dt,
            
            
                amount,
            
           
               money,
            
           
               times,
            
            
                dt_last,
            
            
                rtu_addr_last,
            
            
                controller_id_last,
            
            
                total_amount_last,
            
            
                rtu_dt_last,
            
        
        
            
                #{id,jdbcType=BIGINT},
            
            
                #{intakeId,jdbcType=BIGINT},
            
            
                #{dt,jdbcType=DATE},
            
            
                #{amount,jdbcType=DOUBLE},
            
            
                #{money,jdbcType=DOUBLE},
            
            
                #{times,jdbcType=INTEGER},
            
            
                #{dtLast,jdbcType=TIMESTAMP},
            
            
                #{rtuAddrLast,jdbcType=VARCHAR},
            
            
                #{controllerIdLast,jdbcType=BIGINT},
            
            
                #{totalAmountLast,jdbcType=FLOAT},
            
            
                #{rtuDtLast,jdbcType=TIMESTAMP},
            
        
    
    
        
        update rm_intake_amount_day
        
            
                intake_id = #{intakeId,jdbcType=BIGINT},
            
            
                dt = #{dt,jdbcType=DATE},
            
            
                amount = #{amount,jdbcType=DOUBLE},
            
            
                money = #{money,jdbcType=DOUBLE},
            
            
                times = #{times,jdbcType=INTEGER},
            
            
                dt_last = #{dtLast,jdbcType=TIMESTAMP},
            
            
                rtu_addr_last = #{rtuAddrLast,jdbcType=VARCHAR},
            
            
                controller_id_last = #{controllerIdLast,jdbcType=BIGINT},
            
            
                total_amount_last = #{totalAmountLast,jdbcType=FLOAT},
            
            
                rtu_dt_last = #{rtuDtLast,jdbcType=TIMESTAMP},
            
        
        where id = #{id,jdbcType=BIGINT}
    
    
        
        update rm_intake_amount_day
        set intake_id          = #{intakeId,jdbcType=BIGINT},
            dt                 = #{dt,jdbcType=DATE},
            amount             = #{amount,jdbcType=DOUBLE},
            money              = #{money,jdbcType=DOUBLE},
            times              = #{times,jdbcType=INTEGER},
            dt_last            = #{dtLast,jdbcType=TIMESTAMP},
            rtu_addr_last      = #{rtuAddrLast,jdbcType=VARCHAR},
            controller_id_last = #{controllerIdLast,jdbcType=BIGINT},
            total_amount_last  = #{totalAmountLast,jdbcType=FLOAT},
            rtu_dt_last        = #{rtuDtLast,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=BIGINT}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        SELECT intaId.intakeId   AS intakeId,
               riad.dt           AS dt,
               riad.amount       AS amount
        FROM JSON_TABLE(
            #{intakesJson},
            '$[*]' COLUMNS (
                intakeId BIGINT PATH '$.intakeId'
            )
        ) intaId
        INNER JOIN rm_intake_amount_day riad ON riad.intake_id = intaId.intakeId
        
            
                AND riad.dt =]]> #{startDt, javaType=DATE, jdbcType=DATE}
            
            
                AND riad.dt  #{endDt, javaType=DATE, jdbcType=DATE}