package com.ruoyi.generator.mapper.community;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.generator.domain.Community.CommunityArticle;
import com.ruoyi.generator.domain.Community.CommunityArticleCollect;
import com.ruoyi.generator.domain.Community.CommunityLike;
import com.ruoyi.generator.vo.CommunityArticleVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author Administrator
 * @description 针对表【community_user(用户表)】的数据库操作Mapper
 * @createDate 2024-08-24 15:35:46
 * @Entity com.ruoyi.generator.domain.Community.CommunityUser
 */
@Mapper
public interface CommunityArticleMapper extends BaseMapper<CommunityArticle> {

    int selectCommunityArticleCount(@Param("communityArticle") CommunityArticle communityArticle,
                                    @Param("circleIds") List<Long> circleIds,
                                    @Param("searchType") int searchType);

    /**
     * 获取文章内容首页信息
     *
     * @param communityArticle 文章条件
     * @return 文章首页信息
     */
    List<CommunityArticleVo> selectCommunityArticleList(@Param("communityArticle") CommunityArticle communityArticle,
                                                        @Param("circleIds") List<Long> circleIds,
                                                        @Param("offset") int offset,
                                                        @Param("limit") int limit,
                                                        @Param("searchType") int searchType);

    /**
     * 获取该用户是否收藏该文章
     *
     * @param userId    用户id
     * @param articleId 文章id
     * @return 文章收藏信息
     */
    CommunityArticleCollect selectCommunityArticleCollectById(@Param("userId") Long userId, @Param("articleId") Long articleId);

    /**
     * 获取该用户是否已点赞该文章
     *
     * @param userId    用户id
     * @param articleId 文章id
     * @return 文章点赞信息
     */
    CommunityLike selectCommunityArticleLikeById(@Param("userId") Long userId, @Param("articleId") Long articleId);

    /**
     * 新增点赞
     *
     * @param communityLike 点赞信息
     * @return 点赞是否成功
     */
    boolean insertCommunityLikeById(CommunityLike communityLike);

    /**
     * 删除点赞
     *
     * @param communityLike 点赞信息
     * @return 删除是否成功
     */
    boolean deleteCommunityLikeById(CommunityLike communityLike);

    /**
     * 查询该文章对应的用户是否已经收藏
     *
     * @param collect 收藏信息
     * @return 收藏信息
     */
    CommunityArticleCollect selectCommunityCollectById(CommunityArticleCollect collect);

    /**
     * 新增收藏
     *
     * @param collect 收藏信息
     * @return 收藏是否成功
     */
    boolean insertCommunityCollectById(CommunityArticleCollect collect);


    /**
     * 删除收藏
     *
     * @param collect 收藏信息
     * @return 删除是否成功
     */
    boolean deleteCommunityCollectById(CommunityArticleCollect collect);
}




