package com.aurora.mapper; // 导入评论数据传输对象(DTO),用于前台数据展示 import com.aurora.model.dto.CommentAdminDTO; import com.aurora.model.dto.CommentCountDTO; import com.aurora.model.dto.CommentDTO; import com.aurora.model.dto.ReplyDTO; import com.aurora.entity.Comment;// 导入与数据库表对应的实体类Comment // 导入查询条件值对象 import com.aurora.model.vo.CommentVO; import com.aurora.model.vo.ConditionVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface CommentMapper extends BaseMapper { // 分页获取评论列表(通常用于前台文章详情页的评论展示) // @Param注解给参数起别名,在XML中可以通过#{current}、#{size}、#{commentVO.xxx}引用 // current: 当前页码,size: 每页大小,commentVO: 封装评论查询条件(如文章ID、排序方式等) // 返回CommentDTO列表,包含评论的基本信息和作者信息 List listComments(@Param("current") Long current, @Param("size") Long size, @Param("commentVO") CommentVO commentVO); // 根据评论ID列表获取这些评论的所有回复列表 // commentIdList: 评论ID集合,用于批量查询多个评论的回复 // 返回ReplyDTO列表,包含回复的详细信息(如回复内容、回复对象等) List listReplies(@Param("commentIds") List commentIdList); // 获取前六个热门评论(通常用于前端优先首页展示) // 可能按点赞数、创建时间等排序规则选取前六个评论 List listTopSixComments(); // 统计评论数量(根据查询条件) // conditionVO: 封装统计条件(如时间范围、文章ID、评论状态等) // 返回符合条件的评论总数,用于后台分页计算和数据统计 Integer countComments(@Param("conditionVO") ConditionVO conditionVO); // 分页获取后台评论列表(管理员功能) // 返回CommentAdminDTO列表,可能包含更多管理字段(如IP地址、审核状态、操作日志等) List listCommentsAdmin(@Param("current") Long current, @Param("size") Long size, @Param("conditionVO") ConditionVO conditionVO); // 根据类型和主题ID列表批量统计评论数量 // type: 评论类型(如文章评论、友链评论等),topicIds: 主题ID列表(如文章ID列表) // 返回CommentCountDTO列表,包含每个主题的评论数量统计 List listCommentCountByTypeAndTopicIds(@Param("type") Integer type, @Param("topicIds") List topicIds); // 根据类型和单个主题ID统计评论数量 // topicId: 单个主题ID(如某篇文章的ID) // 返回CommentCountDTO,包含指定主题的评论数量统计 CommentCountDTO listCommentCountByTypeAndTopicId(@Param("type") Integer type, @Param("topicId") Integer topicId); }