package com.fs.course.mapper;

import java.util.List;
import com.fs.course.domain.FsUserCourseLike;
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 FsUserCourseLikeMapper
{
    /**
     * 查询课堂点赞
     *
     * @param id 课堂点赞主键
     * @return 课堂点赞
     */
    public FsUserCourseLike selectFsUserCourseLikeById(Long id);

    /**
     * 查询课堂点赞列表
     *
     * @param fsUserCourseLike 课堂点赞
     * @return 课堂点赞集合
     */
    public List<FsUserCourseLike> selectFsUserCourseLikeList(FsUserCourseLike fsUserCourseLike);

    /**
     * 新增课堂点赞
     *
     * @param fsUserCourseLike 课堂点赞
     * @return 结果
     */
    public int insertFsUserCourseLike(FsUserCourseLike fsUserCourseLike);

    /**
     * 修改课堂点赞
     *
     * @param fsUserCourseLike 课堂点赞
     * @return 结果
     */
    public int updateFsUserCourseLike(FsUserCourseLike fsUserCourseLike);

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

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


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


    @Delete("delete from fs_user_course_like  where course_id =#{courseId} and user_id=#{userId} ")
    int deleteLike(@Param("courseId") Long courseId,@Param("userId")long userId);
}
