diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 8765f68..668e5e0 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -15,28 +15,30 @@ + + + + + + + + + + - - - - - - - - diff --git a/.idea/data_source_mapping.xml b/.idea/data_source_mapping.xml index ba1818a..a83977b 100644 --- a/.idea/data_source_mapping.xml +++ b/.idea/data_source_mapping.xml @@ -1,6 +1,7 @@ + diff --git a/.idea/encodings.xml b/.idea/encodings.xml index d74dd49..104a590 100755 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,6 +3,12 @@ + + + + + + diff --git a/han-note-comment/han-note-comment-api/pom.xml b/han-note-comment/han-note-comment-api/pom.xml new file mode 100644 index 0000000..84cb790 --- /dev/null +++ b/han-note-comment/han-note-comment-api/pom.xml @@ -0,0 +1,24 @@ + + 4.0.0 + + + com.hanserwei + han-note-comment + ${revision} + + + + jar + + han-note-comment-api + ${project.artifactId} + RPC层, 供其他服务调用 + + + + com.hanserwei + hanserwei-common + + + diff --git a/han-note-comment/han-note-comment-biz/pom.xml b/han-note-comment/han-note-comment-biz/pom.xml new file mode 100644 index 0000000..6e176dd --- /dev/null +++ b/han-note-comment/han-note-comment-biz/pom.xml @@ -0,0 +1,91 @@ + + 4.0.0 + + + com.hanserwei + han-note-comment + ${revision} + + + + jar + + han-note-comment-biz + ${project.artifactId} + 评论服务业务层 + + + + com.hanserwei + hanserwei-common + + + + + com.hanserwei + hanserwei-spring-boot-starter-biz-operationlog + + + + + com.hanserwei + hanserwei-spring-boot-starter-biz-context + + + + + com.hanserwei + hanserwei-spring-boot-starter-jackson + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + com.baomidou + mybatis-plus-spring-boot3-starter + + + + + com.mysql + mysql-connector-j + + + + + com.alibaba + druid-spring-boot-3-starter + + + + org.springframework.cloud + spring-cloud-starter-bootstrap + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/han-note-comment/han-note-comment-biz/src/main/java/com/hanserwei/hannote/comment/biz/HannoteCommentApplication.java b/han-note-comment/han-note-comment-biz/src/main/java/com/hanserwei/hannote/comment/biz/HannoteCommentApplication.java new file mode 100644 index 0000000..87982ff --- /dev/null +++ b/han-note-comment/han-note-comment-biz/src/main/java/com/hanserwei/hannote/comment/biz/HannoteCommentApplication.java @@ -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); + } +} diff --git a/han-note-comment/han-note-comment-biz/src/main/resources/application.yml b/han-note-comment/han-note-comment-biz/src/main/resources/application.yml new file mode 100644 index 0000000..3dc7d16 --- /dev/null +++ b/han-note-comment/han-note-comment-biz/src/main/resources/application.yml @@ -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 \ No newline at end of file diff --git a/han-note-comment/han-note-comment-biz/src/main/resources/bootstrap.yml b/han-note-comment/han-note-comment-biz/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..bd32dbf --- /dev/null +++ b/han-note-comment/han-note-comment-biz/src/main/resources/bootstrap.yml @@ -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 # 是否开启动态刷新 \ No newline at end of file diff --git a/han-note-comment/han-note-comment-biz/src/main/resources/logback-spring.xml b/han-note-comment/han-note-comment-biz/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..ea33927 --- /dev/null +++ b/han-note-comment/han-note-comment-biz/src/main/resources/logback-spring.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + ${LOG_FILE}-%i.log + + 30 + + 10MB + + 0 + + false + + + ${LOG_PATTERN} + UTF-8 + + + + + + + 0 + + 256 + + + + + + + + + + + + + + + + + + + + + diff --git a/han-note-comment/pom.xml b/han-note-comment/pom.xml new file mode 100644 index 0000000..07a7803 --- /dev/null +++ b/han-note-comment/pom.xml @@ -0,0 +1,25 @@ + + 4.0.0 + + + com.hanserwei + han-note + ${revision} + + + + pom + + + + han-note-comment-api + han-note-comment-biz + + + han-note-comment + + ${project.artifactId} + + 评论服务 + diff --git a/pom.xml b/pom.xml index b09b21f..e912cbd 100755 --- a/pom.xml +++ b/pom.xml @@ -24,6 +24,7 @@ han-note-count han-note-data-align han-note-search + han-note-comment diff --git a/sql/createTable.sql b/sql/createTable.sql index 46b5c66..029ce50 100644 --- a/sql/createTable.sql +++ b/sql/createTable.sql @@ -240,5 +240,44 @@ CREATE TABLE `t_user_count` COLLATE = utf8mb4_unicode_ci 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 ='评论点赞表';