feat(count): 实现评论计数功能支持二级评论统计
- 新增评论数据对象 CommentDO 及其 MyBatis 映射配置 - 新增评论级别枚举 CommentLevelEnum 区分一级与二级评论 - 新增 CountNoteChildCommentConsumer 消费 MQ 消息并更新子评论总数 - 修改 CountPublishCommentMqDTO 增加 level 和 parentId 字段以支持层级识别 - 调整 Comment2DBConsumer 中构造 CountPublishCommentMqDTO 的逻辑,使用 commentBO 提取完整信息 - 配置 MyBatis Code Helper 插件指向新的 han-note-count 模块路径 - 更新 gateApi.http 测试接口示例,添加 replyCommentId 参数用于模拟二级评论发布
This commit is contained in:
@@ -197,10 +197,12 @@ public class Comment2DBConsumer {
|
||||
// 如果批量插入的行数大于 0
|
||||
if (Objects.nonNull(insertedRows) && insertedRows > 0) {
|
||||
// 构建发送给计数服务的 DTO 集合
|
||||
List<CountPublishCommentMqDTO> countPublishCommentMqDTOS = publishCommentMqDTOS.stream()
|
||||
.map(publishCommentMqDTO -> CountPublishCommentMqDTO.builder()
|
||||
.noteId(publishCommentMqDTO.getNoteId())
|
||||
.commentId(publishCommentMqDTO.getCommentId())
|
||||
List<CountPublishCommentMqDTO> countPublishCommentMqDTOS = commentBOS.stream()
|
||||
.map(commentBO -> CountPublishCommentMqDTO.builder()
|
||||
.noteId(commentBO.getNoteId())
|
||||
.commentId(commentBO.getId())
|
||||
.level(commentBO.getLevel())
|
||||
.parentId(commentBO.getParentId())
|
||||
.build())
|
||||
.toList();
|
||||
|
||||
|
||||
@@ -21,4 +21,14 @@ public class CountPublishCommentMqDTO {
|
||||
*/
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 评论级别
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 父 ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user