package com.fs.course.mapper;

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

/**
 * 达人关注Mapper接口
 *
 * @author fs
 * @date 2024-05-31
 */
public interface FsUserTalentFollowMapper
{
    /**
     * 查询达人关注
     *
     * @param id 达人关注主键
     * @return 达人关注
     */
    public FsUserTalentFollow selectFsUserTalentFollowById(Long id);

    /**
     * 查询达人关注列表
     *
     * @param fsUserTalentFollow 达人关注
     * @return 达人关注集合
     */
    public List<FsUserTalentFollow> selectFsUserTalentFollowList(FsUserTalentFollow fsUserTalentFollow);

    /**
     * 新增达人关注
     *
     * @param fsUserTalentFollow 达人关注
     * @return 结果
     */
    public int insertFsUserTalentFollow(FsUserTalentFollow fsUserTalentFollow);

    /**
     * 修改达人关注
     *
     * @param fsUserTalentFollow 达人关注
     * @return 结果
     */
    public int updateFsUserTalentFollow(FsUserTalentFollow fsUserTalentFollow);

    /**
     * 删除达人关注
     *
     * @param id 达人关注主键
     * @return 结果
     */
    public int deleteFsUserTalentFollowById(Long id);

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

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


    @Delete("delete from fs_user_talent_follow  where talent_id =#{talentId} and user_id=#{userId} ")
    int deleteFollow(@Param("talentId") Long talentId,@Param("userId")long userId);
}
