package com.fs.course.mapper;

import java.util.List;
import com.fs.course.domain.FsUserCourseNoteLike;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 课堂笔记点赞Mapper接口
 *
 * @author fs
 * @date 2024-05-15
 */
public interface FsUserCourseNoteLikeMapper
{
    /**
     * 查询课堂笔记点赞
     *
     * @param id 课堂笔记点赞主键
     * @return 课堂笔记点赞
     */
    public FsUserCourseNoteLike selectFsUserCourseNoteLikeById(Long id);

    /**
     * 查询课堂笔记点赞列表
     *
     * @param fsUserCourseNoteLike 课堂笔记点赞
     * @return 课堂笔记点赞集合
     */
    public List<FsUserCourseNoteLike> selectFsUserCourseNoteLikeList(FsUserCourseNoteLike fsUserCourseNoteLike);

    /**
     * 新增课堂笔记点赞
     *
     * @param fsUserCourseNoteLike 课堂笔记点赞
     * @return 结果
     */
    public int insertFsUserCourseNoteLike(FsUserCourseNoteLike fsUserCourseNoteLike);

    /**
     * 修改课堂笔记点赞
     *
     * @param fsUserCourseNoteLike 课堂笔记点赞
     * @return 结果
     */
    public int updateFsUserCourseNoteLike(FsUserCourseNoteLike fsUserCourseNoteLike);

    /**
     * 删除课堂笔记点赞
     *
     * @param id 课堂笔记点赞主键
     * @return 结果
     */
    public int deleteFsUserCourseNoteLikeById(Long id);

    /**
     * 批量删除课堂笔记点赞
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsUserCourseNoteLikeByIds(Long[] ids);


    @Select("select ifnull(count(1),0) from fs_user_course_note_like  where note_id =#{noteId} and user_id=#{userId}")
    int checkLike(@Param("noteId") Long noteId, @Param("userId")long userId);


    @Delete("delete from fs_user_course_note_like  where note_id =#{noteId} and user_id=#{userId} ")
    int deleteLike(@Param("noteId") Long noteId,@Param("userId")long userId);
}
