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:
@@ -0,0 +1,51 @@
|
||||
<?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.CommentDOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.count.biz.domain.dataobject.CommentDO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table t_comment-->
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="note_id" jdbcType="BIGINT" property="noteId"/>
|
||||
<result column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||
<result column="content_uuid" jdbcType="VARCHAR" property="contentUuid"/>
|
||||
<result column="is_content_empty" jdbcType="BIT" property="isContentEmpty"/>
|
||||
<result column="image_url" jdbcType="VARCHAR" property="imageUrl"/>
|
||||
<result column="level" jdbcType="TINYINT" property="level"/>
|
||||
<result column="reply_total" jdbcType="BIGINT" property="replyTotal"/>
|
||||
<result column="like_total" jdbcType="BIGINT" property="likeTotal"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
<result column="reply_comment_id" jdbcType="BIGINT" property="replyCommentId"/>
|
||||
<result column="reply_user_id" jdbcType="BIGINT" property="replyUserId"/>
|
||||
<result column="is_top" jdbcType="TINYINT" property="isTop"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="child_comment_total" jdbcType="BIGINT" property="childCommentTotal"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id,
|
||||
note_id,
|
||||
user_id,
|
||||
content_uuid,
|
||||
is_content_empty,
|
||||
image_url,
|
||||
`level`,
|
||||
reply_total,
|
||||
like_total,
|
||||
parent_id,
|
||||
reply_comment_id,
|
||||
reply_user_id,
|
||||
is_top,
|
||||
create_time,
|
||||
update_time,
|
||||
child_comment_total
|
||||
</sql>
|
||||
|
||||
<update id="updateChildCommentTotal" parameterType="map">
|
||||
update t_comment
|
||||
set child_comment_total = child_comment_total + #{count},
|
||||
update_time = now()
|
||||
where id = #{parentId}
|
||||
and level = 1
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user