package com.fs.his.mapper;

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

/**
 * 疗法收藏Mapper接口
 *
 * @author fs
 * @date 2024-08-24
 */
public interface FsPackageFavoriteMapper
{
    /**
     * 查询疗法收藏
     *
     * @param favoriteId 疗法收藏主键
     * @return 疗法收藏
     */
    public FsPackageFavorite selectFsPackageFavoriteByFavoriteId(Long favoriteId);

    /**
     * 查询疗法收藏列表
     *
     * @param fsPackageFavorite 疗法收藏
     * @return 疗法收藏集合
     */
    public List<FsPackageFavorite> selectFsPackageFavoriteList(FsPackageFavorite fsPackageFavorite);

    /**
     * 新增疗法收藏
     *
     * @param fsPackageFavorite 疗法收藏
     * @return 结果
     */
    public int insertFsPackageFavorite(FsPackageFavorite fsPackageFavorite);

    /**
     * 修改疗法收藏
     *
     * @param fsPackageFavorite 疗法收藏
     * @return 结果
     */
    public int updateFsPackageFavorite(FsPackageFavorite fsPackageFavorite);

    /**
     * 删除疗法收藏
     *
     * @param favoriteId 疗法收藏主键
     * @return 结果
     */
    public int deleteFsPackageFavoriteByFavoriteId(Long favoriteId);

    /**
     * 批量删除疗法收藏
     *
     * @param favoriteIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsPackageFavoriteByFavoriteIds(Long[] favoriteIds);

    @Select("select ifnull(count(1),0) from fs_package_favorite  where package_id =#{packageId} and user_id=#{userId}")
    int checkFavorite(@Param("packageId") Long packageId, @Param("userId") long userId);

    @Delete("delete from fs_package_favorite  where package_id =#{packageId} and user_id=#{userId} ")
    int deleteFavorite(@Param("packageId") Long packageId,@Param("userId")long userId);
}
