feat(count): 新增笔记和用户计数相关数据结构和服务

- 新增笔记收藏表(NoteCollectionDO)及相关Mapper和服务实现
- 新增笔记计数表(NoteCountDO)及相关Mapper和服务实现
- 新增笔记点赞表(NoteLikeDO)及相关Mapper和服务实现
- 新增用户计数表(UserCountDO)及相关Mapper和服务实现
- 配置RedisTemplate以支持JSON格式序列化
- 引入RocketMQ依赖并配置自动装配
- 在count模块中添加Redis和RocketMQ相关配置类
This commit is contained in:
2025-10-15 19:26:18 +08:00
parent 893f52e5aa
commit 3904e8510e
24 changed files with 502 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package com.hanserwei.hannote.note.biz.domain.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 笔记收藏表
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "t_note_collection")
public class NoteCollectionDO {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 用户ID
*/
@TableField(value = "user_id")
private Long userId;
/**
* 笔记ID
*/
@TableField(value = "note_id")
private Long noteId;
/**
* 创建时间
*/
@TableField(value = "create_time")
private Date createTime;
/**
* 收藏状态(0取消收藏 1收藏)
*/
@TableField(value = "`status`")
private Byte status;
}

View File

@@ -0,0 +1,51 @@
package com.hanserwei.hannote.note.biz.domain.dataobject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 笔记点赞表
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "t_note_like")
public class NoteLikeDO {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 用户ID
*/
@TableField(value = "user_id")
private Long userId;
/**
* 笔记ID
*/
@TableField(value = "note_id")
private Long noteId;
/**
* 创建时间
*/
@TableField(value = "create_time")
private Date createTime;
/**
* 点赞状态(0取消点赞 1点赞)
*/
@TableField(value = "`status`")
private Byte status;
}

View File

@@ -0,0 +1,9 @@
package com.hanserwei.hannote.note.biz.domain.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteCollectionDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface NoteCollectionDOMapper extends BaseMapper<NoteCollectionDO> {
}

View File

@@ -0,0 +1,9 @@
package com.hanserwei.hannote.note.biz.domain.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteLikeDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface NoteLikeDOMapper extends BaseMapper<NoteLikeDO> {
}

View File

@@ -0,0 +1,8 @@
package com.hanserwei.hannote.note.biz.service;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteCollectionDO;
import com.baomidou.mybatisplus.extension.service.IService;
public interface NoteCollectionDOService extends IService<NoteCollectionDO>{
}

View File

@@ -0,0 +1,8 @@
package com.hanserwei.hannote.note.biz.service;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteLikeDO;
import com.baomidou.mybatisplus.extension.service.IService;
public interface NoteLikeDOService extends IService<NoteLikeDO>{
}

View File

@@ -0,0 +1,13 @@
package com.hanserwei.hannote.note.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteCollectionDO;
import com.hanserwei.hannote.note.biz.domain.mapper.NoteCollectionDOMapper;
import com.hanserwei.hannote.note.biz.service.NoteCollectionDOService;
@Service
public class NoteCollectionDOServiceImpl extends ServiceImpl<NoteCollectionDOMapper, NoteCollectionDO> implements NoteCollectionDOService{
}

View File

@@ -0,0 +1,13 @@
package com.hanserwei.hannote.note.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.note.biz.domain.mapper.NoteLikeDOMapper;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteLikeDO;
import com.hanserwei.hannote.note.biz.service.NoteLikeDOService;
@Service
public class NoteLikeDOServiceImpl extends ServiceImpl<NoteLikeDOMapper, NoteLikeDO> implements NoteLikeDOService{
}

View File

@@ -0,0 +1,17 @@
<?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.note.biz.domain.mapper.NoteCollectionDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.note.biz.domain.dataobject.NoteCollectionDO">
<!--@mbg.generated-->
<!--@Table t_note_collection-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="note_id" jdbcType="BIGINT" property="noteId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="status" jdbcType="TINYINT" property="status" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, note_id, create_time, `status`
</sql>
</mapper>

View File

@@ -0,0 +1,17 @@
<?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.note.biz.domain.mapper.NoteLikeDOMapper">
<resultMap id="BaseResultMap" type="com.hanserwei.hannote.note.biz.domain.dataobject.NoteLikeDO">
<!--@mbg.generated-->
<!--@Table t_note_like-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="note_id" jdbcType="BIGINT" property="noteId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="status" jdbcType="TINYINT" property="status" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, note_id, create_time, `status`
</sql>
</mapper>