package com.fs.course.mapper;

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

/**
 * 课堂关注Mapper接口
 *
 * @author fs
 * @date 2024-05-17
 */
public interface FsUserCourseFollowMapper
{
    /**
     * 查询课堂关注
     *
     * @param id 课堂关注主键
     * @return 课堂关注
     */
    public FsUserCourseFollow selectFsUserCourseFollowById(Long id);

    /**
     * 查询课堂关注列表
     *
     * @param fsUserCourseFollow 课堂关注
     * @return 课堂关注集合
     */
    public List<FsUserCourseFollow> selectFsUserCourseFollowList(FsUserCourseFollow fsUserCourseFollow);

    /**
     * 新增课堂关注
     *
     * @param fsUserCourseFollow 课堂关注
     * @return 结果
     */
    public int insertFsUserCourseFollow(FsUserCourseFollow fsUserCourseFollow);

    /**
     * 修改课堂关注
     *
     * @param fsUserCourseFollow 课堂关注
     * @return 结果
     */
    public int updateFsUserCourseFollow(FsUserCourseFollow fsUserCourseFollow);

    /**
     * 删除课堂关注
     *
     * @param id 课堂关注主键
     * @return 结果
     */
    public int deleteFsUserCourseFollowById(Long id);

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


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


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