package com.fs.course.mapper;

import java.util.List;

import com.fs.course.domain.FsUserCourseNoteSave;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 课堂笔记保存Mapper接口
 *
 * @author fs
 * @date 2024-06-05
 */
public interface FsUserCourseNoteSaveMapper
{
    /**
     * 查询课堂笔记保存
     *
     * @param saveId 课堂笔记保存主键
     * @return 课堂笔记保存
     */
    public FsUserCourseNoteSave selectFsUserCourseNoteSaveBySaveId(Long saveId);

    /**
     * 查询课堂笔记保存列表
     *
     * @param fsUserCourseNoteSave 课堂笔记保存
     * @return 课堂笔记保存集合
     */
    public List<FsUserCourseNoteSave> selectFsUserCourseNoteSaveList(FsUserCourseNoteSave fsUserCourseNoteSave);

    /**
     * 新增课堂笔记保存
     *
     * @param fsUserCourseNoteSave 课堂笔记保存
     * @return 结果
     */
    public int insertFsUserCourseNoteSave(FsUserCourseNoteSave fsUserCourseNoteSave);

    /**
     * 修改课堂笔记保存
     *
     * @param fsUserCourseNoteSave 课堂笔记保存
     * @return 结果
     */
    public int updateFsUserCourseNoteSave(FsUserCourseNoteSave fsUserCourseNoteSave);

    /**
     * 删除课堂笔记保存
     *
     * @param saveId 课堂笔记保存主键
     * @return 结果
     */
    public int deleteFsUserCourseNoteSaveBySaveId(Long saveId);

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

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


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