<?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.fs.course.mapper.FsUserVideoCommentLikeMapper">

    <resultMap type="FsUserVideoCommentLike" id="FsUserVideoCommentLikeResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="commentId"    column="comment_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectFsUserVideoCommentLikeVo">
        select id, user_id, comment_id, create_time, update_time from fs_user_video_comment_like
    </sql>

    <select id="selectFsUserVideoCommentLikeList" parameterType="FsUserVideoCommentLike" resultMap="FsUserVideoCommentLikeResult">
        <include refid="selectFsUserVideoCommentLikeVo"/>
        <where>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="commentId != null "> and comment_id = #{commentId}</if>
        </where>
    </select>

    <select id="selectFsUserVideoCommentLikeById" parameterType="Long" resultMap="FsUserVideoCommentLikeResult">
        <include refid="selectFsUserVideoCommentLikeVo"/>
        where id = #{id}
    </select>

    <insert id="insertFsUserVideoCommentLike" parameterType="FsUserVideoCommentLike" useGeneratedKeys="true" keyProperty="id">
        insert into fs_user_video_comment_like
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null">user_id,</if>
            <if test="commentId != null">comment_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null">#{userId},</if>
            <if test="commentId != null">#{commentId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateFsUserVideoCommentLike" parameterType="FsUserVideoCommentLike">
        update fs_user_video_comment_like
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="commentId != null">comment_id = #{commentId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFsUserVideoCommentLikeById" parameterType="Long">
        delete from fs_user_video_comment_like where id = #{id}
    </delete>

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