- 新增 CountPublishCommentMqDTO 用于传输评论计数消息 - 在评论服务中添加异步发送评论计数消息逻辑 - 新建 CountNoteCommentConsumer 消费评论计数消息并批量更新笔记评论数 - 扩展 t_comment 表结构,新增 child_comment_total 字段 - 更新 MQ 常量配置,添加评论计数相关 Topic 定义 - 调整 LIKE/UNLIKE 和 COLLECT/UNCOLLECT 消费者中的注解使用(防止循环依赖) - 修改 gateApi.http 中的测试用例内容以适配新功能
35 lines
1.6 KiB
XML
35 lines
1.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.hanserwei.hannote.count.biz.domain.mapper.NoteCountDOMapper">
|
|
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.count.biz.domain.dataobject.NoteCountDO">
|
|
<!--@mbg.generated-->
|
|
<!--@Table t_note_count-->
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="note_id" jdbcType="BIGINT" property="noteId" />
|
|
<result column="like_total" jdbcType="BIGINT" property="likeTotal" />
|
|
<result column="collect_total" jdbcType="BIGINT" property="collectTotal" />
|
|
<result column="comment_total" jdbcType="BIGINT" property="commentTotal" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
<!--@mbg.generated-->
|
|
id, note_id, like_total, collect_total, comment_total
|
|
</sql>
|
|
|
|
<insert id="insertOrUpdateLikeTotalByNoteId" parameterType="map">
|
|
INSERT INTO t_note_count (note_id, like_total)
|
|
VALUES (#{noteId}, #{count})
|
|
ON DUPLICATE KEY UPDATE like_total = like_total + (#{count});
|
|
</insert>
|
|
|
|
<insert id="insertOrUpdateCollectTotalByNoteId" parameterType="map">
|
|
INSERT INTO t_note_count (note_id, collect_total)
|
|
VALUES (#{noteId}, #{count})
|
|
ON DUPLICATE KEY UPDATE collect_total = collect_total + (#{count});
|
|
</insert>
|
|
|
|
<insert id="insertOrUpdateCommentTotalByNoteId" parameterType="map">
|
|
INSERT INTO t_note_count (note_id, comment_total)
|
|
VALUES (#{noteId}, #{count})
|
|
ON DUPLICATE KEY UPDATE comment_total = comment_total + (#{count});
|
|
</insert>
|
|
</mapper> |