feat(count): 新增笔记收藏与点赞计数聚合功能,用户维度统计功能

- 新增 AggregationCountCollectedUncollectedNoteMqDTO 和 AggregationCountLikeUnlikeNoteMqDTO 聚合消息体
- 在 CollectUnCollectNoteMqDTO、CountCollectUnCollectNoteMqDTO 和 CountLikeUnlikeNoteMqDTO 中添加 noteCreatorId 字段
- 优化 CountNoteCollect2DBConsumer 和 CountNoteLike2DBConsumer 消费者逻辑,支持事务性更新用户及笔记计数
- 修改 CountNoteCollectConsumer 和 CountNoteLikeConsumer,使用聚合 DTO 替代 Map 结构处理计数逻辑
- 扩展 JsonUtils 工具类,新增 parseList 方法用于解析 JSON 到 List 对象
- 更新 NoteServiceImpl 中点赞和收藏相关方法,补充获取并传递 noteCreatorId 参数
- 在 UserCountDOMapper 及其 XML 映射文件中新增点赞数和收藏数的插入或更新操作接口
This commit is contained in:
2025-10-19 17:18:20 +08:00
parent 564eefa7bc
commit 7b1df60c05
14 changed files with 295 additions and 54 deletions

View File

@@ -28,4 +28,16 @@
VALUES (#{userId}, #{count})
ON DUPLICATE KEY UPDATE following_total = following_total + (#{count});
</insert>
<insert id="insertOrUpdateLikeTotalByUserId" parameterType="map">
INSERT INTO t_user_count (user_id, like_total)
VALUES (#{userId}, #{count})
ON DUPLICATE KEY UPDATE like_total = like_total + (#{count});
</insert>
<insert id="insertOrUpdateCollectTotalByUserId" parameterType="map">
INSERT INTO t_user_count (user_id, collect_total)
VALUES (#{userId}, #{count})
ON DUPLICATE KEY UPDATE collect_total = collect_total + (#{count});
</insert>
</mapper>