<?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.abuwx.mapper.InfoOperationRecordMapper">
    
    <resultMap type="InfoOperationRecord" id="InfoOperationRecordResult">
        <result property="id"    column="id"    />
        <result property="infoId"    column="info_id"    />
        <result property="operateType"    column="operate_type"    />
        <result property="operateTime"    column="operate_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectInfoOperationRecordVo">
        select id, info_id, operate_type, operate_time, create_time, update_time, remark, create_by, update_by from info_operation_record
    </sql>

    <select id="selectInfoOperationRecordList" parameterType="InfoOperationRecord" resultMap="InfoOperationRecordResult">
        <include refid="selectInfoOperationRecordVo"/>
        <where>  
            <if test="infoId != null "> and info_id = #{infoId}</if>
            <if test="operateType != null  and operateType != ''"> and operate_type = #{operateType}</if>
            <if test="operateTime != null "> and operate_time = #{operateTime}</if>
        </where>
    </select>
    
    <select id="selectInfoOperationRecordById" parameterType="Long" resultMap="InfoOperationRecordResult">
        <include refid="selectInfoOperationRecordVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertInfoOperationRecord" parameterType="InfoOperationRecord" useGeneratedKeys="true" keyProperty="id">
        insert into info_operation_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="infoId != null">info_id,</if>
            <if test="operateType != null">operate_type,</if>
            <if test="operateTime != null">operate_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="infoId != null">#{infoId},</if>
            <if test="operateType != null">#{operateType},</if>
            <if test="operateTime != null">#{operateTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateInfoOperationRecord" parameterType="InfoOperationRecord">
        update info_operation_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="infoId != null">info_id = #{infoId},</if>
            <if test="operateType != null">operate_type = #{operateType},</if>
            <if test="operateTime != null">operate_time = #{operateTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteInfoOperationRecordById" parameterType="Long">
        delete from info_operation_record where id = #{id}
    </delete>

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