<?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.VideoOperationRecordMapper">
    
    <resultMap type="VideoOperationRecord" id="VideoOperationRecordResult">
        <result property="id"    column="id"    />
        <result property="videoId"    column="video_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="selectVideoOperationRecordVo">
        select id, video_id, operate_type, operate_time, create_time, update_time, remark, create_by, update_by from video_operation_record
    </sql>

    <select id="selectVideoOperationRecordList" parameterType="VideoOperationRecord" resultMap="VideoOperationRecordResult">
        <include refid="selectVideoOperationRecordVo"/>
        <where>  
            <if test="videoId != null "> and video_id = #{videoId}</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="selectVideoOperationRecordById" parameterType="Long" resultMap="VideoOperationRecordResult">
        <include refid="selectVideoOperationRecordVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertVideoOperationRecord" parameterType="VideoOperationRecord" useGeneratedKeys="true" keyProperty="id">
        insert into video_operation_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="videoId != null">video_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="videoId != null">#{videoId},</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="updateVideoOperationRecord" parameterType="VideoOperationRecord">
        update video_operation_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="videoId != null">video_id = #{videoId},</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="deleteVideoOperationRecordById" parameterType="Long">
        delete from video_operation_record where id = #{id}
    </delete>

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