feat(comment): 初始化评论服务模块
- 新增评论服务基础结构,包括 api 和 biz 模块 - 配置应用启动端口、Nacos 服务发现与配置中心 - 添加 MyBatis-Plus、MySQL、Druid 等依赖 - 创建评论表和评论点赞表 SQL 脚本 - 配置日志输出格式及异步写入策略 - 更新 IDEA 编码设置和数据源映射 - 在父级 pom 中注册评论服务模块
This commit is contained in:
18
.idea/compiler.xml
generated
18
.idea/compiler.xml
generated
@@ -15,28 +15,30 @@
|
|||||||
<processorPath useClasspath="false">
|
<processorPath useClasspath="false">
|
||||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.30/lombok-1.18.30.jar" />
|
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.30/lombok-1.18.30.jar" />
|
||||||
</processorPath>
|
</processorPath>
|
||||||
|
<module name="han-note-distributed-id-generator-api" />
|
||||||
|
<module name="han-note-data-align" />
|
||||||
|
<module name="han-note-note-biz" />
|
||||||
|
<module name="han-note-user-relation-api" />
|
||||||
|
<module name="han-note-user-api" />
|
||||||
|
<module name="han-note-user-biz" />
|
||||||
|
<module name="han-note-distributed-id-generator-biz" />
|
||||||
|
<module name="han-note-user-relation-biz" />
|
||||||
<module name="han-note-oss-biz" />
|
<module name="han-note-oss-biz" />
|
||||||
|
<module name="han-note-comment-biz" />
|
||||||
<module name="han-note-count-api" />
|
<module name="han-note-count-api" />
|
||||||
<module name="han-note-oss-api" />
|
<module name="han-note-oss-api" />
|
||||||
<module name="han-note-count-biz" />
|
<module name="han-note-count-biz" />
|
||||||
|
<module name="han-note-comment-api" />
|
||||||
<module name="hanserwei-spring-boot-starter-biz-operationlog" />
|
<module name="hanserwei-spring-boot-starter-biz-operationlog" />
|
||||||
<module name="han-note-gateway" />
|
<module name="han-note-gateway" />
|
||||||
<module name="han-note-note-api" />
|
<module name="han-note-note-api" />
|
||||||
<module name="hanserwei-spring-boot-starter-jackson" />
|
<module name="hanserwei-spring-boot-starter-jackson" />
|
||||||
<module name="han-note-distributed-id-generator-api" />
|
|
||||||
<module name="han-note-data-align" />
|
|
||||||
<module name="han-note-kv-api" />
|
<module name="han-note-kv-api" />
|
||||||
<module name="han-note-note-biz" />
|
|
||||||
<module name="han-note-search-api" />
|
<module name="han-note-search-api" />
|
||||||
<module name="han-note-user-relation-api" />
|
|
||||||
<module name="han-note-user-api" />
|
|
||||||
<module name="han-note-user-biz" />
|
|
||||||
<module name="han-note-kv-biz" />
|
<module name="han-note-kv-biz" />
|
||||||
<module name="hanserwei-common" />
|
<module name="hanserwei-common" />
|
||||||
<module name="han-note-distributed-id-generator-biz" />
|
|
||||||
<module name="han-note-auth" />
|
<module name="han-note-auth" />
|
||||||
<module name="han-note-search-biz" />
|
<module name="han-note-search-biz" />
|
||||||
<module name="han-note-user-relation-biz" />
|
|
||||||
<module name="hanserwei-spring-boot-starter-biz-context" />
|
<module name="hanserwei-spring-boot-starter-biz-context" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
|||||||
1
.idea/data_source_mapping.xml
generated
1
.idea/data_source_mapping.xml
generated
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourcePerFileMappings">
|
<component name="DataSourcePerFileMappings">
|
||||||
|
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/19b59a4f-95b9-451e-9051-bb3d5ce210ee/console.sql" value="19b59a4f-95b9-451e-9051-bb3d5ce210ee" />
|
||||||
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/5b969fbe-0f66-42be-8d30-ff21036ab8a4/console.sql" value="5b969fbe-0f66-42be-8d30-ff21036ab8a4" />
|
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/5b969fbe-0f66-42be-8d30-ff21036ab8a4/console.sql" value="5b969fbe-0f66-42be-8d30-ff21036ab8a4" />
|
||||||
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f2474a4a-e4f1-4afa-bd43-7ae7738b47c5/console.sql" value="f2474a4a-e4f1-4afa-bd43-7ae7738b47c5" />
|
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/f2474a4a-e4f1-4afa-bd43-7ae7738b47c5/console.sql" value="f2474a4a-e4f1-4afa-bd43-7ae7738b47c5" />
|
||||||
<file url="file://$PROJECT_DIR$/han-note-data-align/src/main/resources/mapperxml/InsertMapper.xml" value="f2474a4a-e4f1-4afa-bd43-7ae7738b47c5" />
|
<file url="file://$PROJECT_DIR$/han-note-data-align/src/main/resources/mapperxml/InsertMapper.xml" value="f2474a4a-e4f1-4afa-bd43-7ae7738b47c5" />
|
||||||
|
|||||||
6
.idea/encodings.xml
generated
6
.idea/encodings.xml
generated
@@ -3,6 +3,12 @@
|
|||||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||||
<file url="file://$PROJECT_DIR$/han-note-auth/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/han-note-auth/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/han-note-auth/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/han-note-auth/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/han-note-comment/han-note-comment-api/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/han-note-comment/han-note-comment-api/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/han-note-comment/han-note-comment-biz/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/han-note-comment/han-note-comment-biz/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/han-note-comment/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/han-note-comment/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/han-note-count/han-note-count-api/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/han-note-count/han-note-count-api/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/han-note-count/han-note-count-api/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/han-note-count/han-note-count-api/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/han-note-count/han-note-count-biz/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/han-note-count/han-note-count-biz/src/main/java" charset="UTF-8" />
|
||||||
|
|||||||
24
han-note-comment/han-note-comment-api/pom.xml
Normal file
24
han-note-comment/han-note-comment-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<!-- 指定父项目 -->
|
||||||
|
<parent>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>han-note-comment</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<!-- 打包方式 -->
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<artifactId>han-note-comment-api</artifactId>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>RPC层, 供其他服务调用</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>hanserwei-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
91
han-note-comment/han-note-comment-biz/pom.xml
Normal file
91
han-note-comment/han-note-comment-biz/pom.xml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<!-- 指定父项目 -->
|
||||||
|
<parent>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>han-note-comment</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<!-- 打包方式 -->
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<artifactId>han-note-comment-biz</artifactId>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>评论服务业务层</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>hanserwei-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 业务接口日志组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>hanserwei-spring-boot-starter-biz-operationlog</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 上下文组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>hanserwei-spring-boot-starter-biz-context</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jackson 组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>hanserwei-spring-boot-starter-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mybatis-plus -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MySQL 驱动 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Druid 数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 服务发现 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.hanserwei.hannote.comment.biz;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.hanserwei.hannote.comment.biz.domain.mapper")
|
||||||
|
public class HannoteCommentApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(HannoteCommentApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
server:
|
||||||
|
port: 8093 # 项目启动的端口
|
||||||
|
|
||||||
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: dev # 默认激活 dev 本地开发环境
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 20MB # 单个文件最大大小
|
||||||
|
max-request-size: 100MB # 单次请求最大大小(包含多个文件)
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||||
|
global-config:
|
||||||
|
banner: false
|
||||||
|
mapper-locations: classpath*:/mapperxml/*.xml
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: han-note-comment # 应用名称
|
||||||
|
profiles:
|
||||||
|
active: dev # 默认激活 dev 本地开发环境
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
enabled: true # 启用服务发现
|
||||||
|
group: DEFAULT_GROUP # 所属组
|
||||||
|
namespace: han-note # 命名空间
|
||||||
|
server-addr: 127.0.0.1:8848 # 指定 Nacos 配置中心的服务器地址
|
||||||
|
config:
|
||||||
|
server-addr: http://127.0.0.1:8848 # 指定 Nacos 配置中心的服务器地址
|
||||||
|
prefix: ${spring.application.name} # 配置 Data Id 前缀,这里使用应用名称作为前缀
|
||||||
|
group: DEFAULT_GROUP # 所属组
|
||||||
|
namespace: han-note # 命名空间
|
||||||
|
file-extension: yaml # 配置文件格式
|
||||||
|
refresh-enabled: true # 是否开启动态刷新
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<configuration>
|
||||||
|
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||||
|
|
||||||
|
<!-- 应用名称 -->
|
||||||
|
<property scope="context" name="appName" value="comment"/>
|
||||||
|
<!-- 自定义日志输出路径,以及日志名称前缀 -->
|
||||||
|
<property name="LOG_FILE" value="./logs/${appName}.%d{yyyy-MM-dd}"/>
|
||||||
|
<!-- 每行日志输出的格式 -->
|
||||||
|
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 文件输出 -->
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件的命名格式 -->
|
||||||
|
<fileNamePattern>${LOG_FILE}-%i.log</fileNamePattern>
|
||||||
|
<!-- 保留 30 天的日志文件 -->
|
||||||
|
<maxHistory>30</maxHistory>
|
||||||
|
<!-- 单个日志文件最大大小 -->
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||||
|
<totalSizeCap>0</totalSizeCap>
|
||||||
|
<!-- 重启服务时,是否清除历史日志,不推荐清理 -->
|
||||||
|
<cleanHistoryOnStart>false</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<pattern>${LOG_PATTERN}</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 异步写入日志,提升性能 -->
|
||||||
|
<appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
|
<!-- 是否丢弃日志, 0 表示不丢弃。默认情况下,如果队列满 80%, 会丢弃 TRACE、DEBUG、INFO 级别的日志 -->
|
||||||
|
<discardingThreshold>0</discardingThreshold>
|
||||||
|
<!-- 队列大小。默认值为 256 -->
|
||||||
|
<queueSize>256</queueSize>
|
||||||
|
<appender-ref ref="FILE"/>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 本地 dev 开发环境 -->
|
||||||
|
<springProfile name="dev">
|
||||||
|
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE"/> <!-- 输出控制台日志 -->
|
||||||
|
<appender-ref ref="ASYNC_FILE"/> <!-- 打印日志到文件中。PS: 本地环境下,如果不想打印日志到文件,可注释掉此行 -->
|
||||||
|
</root>
|
||||||
|
</springProfile>
|
||||||
|
|
||||||
|
<!-- 其它环境 -->
|
||||||
|
<springProfile name="prod">
|
||||||
|
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="ASYNC_FILE"/> <!-- 生产环境下,仅打印日志到文件中 -->
|
||||||
|
</root>
|
||||||
|
</springProfile>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
25
han-note-comment/pom.xml
Normal file
25
han-note-comment/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<!-- 指定父项目 -->
|
||||||
|
<parent>
|
||||||
|
<groupId>com.hanserwei</groupId>
|
||||||
|
<artifactId>han-note</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<!-- 多模块项目需要配置打包方式为 pom -->
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<!-- 子模块管理 -->
|
||||||
|
<modules>
|
||||||
|
<module>han-note-comment-api</module>
|
||||||
|
<module>han-note-comment-biz</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<artifactId>han-note-comment</artifactId>
|
||||||
|
<!-- 项目名称 -->
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<!-- 项目描述 -->
|
||||||
|
<description>评论服务</description>
|
||||||
|
</project>
|
||||||
1
pom.xml
1
pom.xml
@@ -24,6 +24,7 @@
|
|||||||
<module>han-note-count</module>
|
<module>han-note-count</module>
|
||||||
<module>han-note-data-align</module>
|
<module>han-note-data-align</module>
|
||||||
<module>han-note-search</module>
|
<module>han-note-search</module>
|
||||||
|
<module>han-note-comment</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -240,5 +240,44 @@ CREATE TABLE `t_user_count`
|
|||||||
COLLATE = utf8mb4_unicode_ci
|
COLLATE = utf8mb4_unicode_ci
|
||||||
COMMENT ='用户计数表';
|
COMMENT ='用户计数表';
|
||||||
|
|
||||||
|
-- 表:t_comment
|
||||||
|
CREATE TABLE `t_comment`
|
||||||
|
(
|
||||||
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`note_id` bigint unsigned NOT NULL COMMENT '关联的笔记ID',
|
||||||
|
`user_id` bigint unsigned NOT NULL COMMENT '发布者用户ID',
|
||||||
|
`content_uuid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '评论内容UUID',
|
||||||
|
`is_content_empty` bit NOT NULL DEFAULT b'0' COMMENT '内容是否为空(0:不为空 1:为空)',
|
||||||
|
`image_url` varchar(60) NOT NULL DEFAULT '' COMMENT '评论附加图片URL',
|
||||||
|
`level` tinyint NOT NULL DEFAULT '1' COMMENT '级别(1:一级评论 2:二级评论)',
|
||||||
|
`reply_total` bigint unsigned DEFAULT 0 COMMENT '评论被回复次数,仅一级评论需要',
|
||||||
|
`like_total` bigint DEFAULT 0 COMMENT '评论被点赞次数',
|
||||||
|
`parent_id` bigint unsigned DEFAULT 0 COMMENT '父ID (若是对笔记的评论,则此字段存储笔记ID; 若是二级评论,则此字段存储一级评论的ID)',
|
||||||
|
`reply_comment_id` bigint unsigned DEFAULT 0 COMMENT '回复哪个的评论 (0表示是对笔记的评论,若是对他人评论的回复,则存储回复评论的ID)',
|
||||||
|
`reply_user_id` bigint unsigned DEFAULT 0 COMMENT '回复的哪个用户, 存储用户ID',
|
||||||
|
`is_top` tinyint NOT NULL DEFAULT '0' COMMENT '是否置顶(0:不置顶 1:置顶)',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
KEY `idx_note_id` (`note_id`) USING BTREE,
|
||||||
|
KEY `idx_user_id` (`user_id`) USING BTREE,
|
||||||
|
KEY `idx_parent_id` (`parent_id`) USING BTREE,
|
||||||
|
KEY `idx_create_time` (`create_time`) USING BTREE,
|
||||||
|
KEY `idx_reply_comment_id` (`reply_comment_id`) USING BTREE,
|
||||||
|
KEY `idx_reply_user_id` (`reply_user_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '评论表';
|
||||||
|
|
||||||
|
-- 表:t_comment_like
|
||||||
|
CREATE TABLE `t_comment_like`
|
||||||
|
(
|
||||||
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`user_id` bigint NOT NULL COMMENT '用户ID',
|
||||||
|
`comment_id` bigint NOT NULL COMMENT '评论ID',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_user_id_comment_id` (`user_id`, `comment_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_unicode_ci COMMENT ='评论点赞表';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user