refactor(消息模块): 重构消息服务及控制器功能

重构消息模块,包括以下主要变更:
1. 将MessageRepository从CrudRepository扩展改为JpaRepository
2. 新增消息查询方法,支持按文章ID、父消息ID和昵称查询
3. 完善消息服务层逻辑,增加日志记录和错误处理
4. 扩展消息控制器API,新增获取根消息、回复消息等端点
5. 添加消息数据初始化组件和检查器
6. 优化全局异常处理,增加请求路径日志

同时调整文章模块:
1. 移除按作者查询文章功能
2. 统一分类查询参数命名
3. 优化文章服务层代码结构

配置变更:
1. 添加缓存相关依赖
2. 调整数据库连接配置
3. 暂时禁用Hibernate二级缓存
This commit is contained in:
qingfeng1121
2025-10-11 11:17:12 +08:00
parent 60f4752124
commit 470cf71713
15 changed files with 5025 additions and 6756 deletions

View File

@@ -32,6 +32,7 @@ public class ArticleController {
@GetMapping("/{id}")
public ResponseMessage<Article> getArticle(@PathVariable Integer id) {
return articleService.getArticleById(id);
}
/**
@@ -82,24 +83,15 @@ public class ArticleController {
return articleService.deleteArticle(id);
}
/**
* 根据作者ID获取其所有文章
* @param authorId 作者ID
* @return 返回包含文章列表的ResponseMessage对象
*/
@GetMapping("/author/{authorId}")
public ResponseMessage<List<Article>> getArticlesByAuthor(@PathVariable Integer authorId) {
return articleService.getArticlesByAuthor(authorId);
}
/**
* 根据分类ID获取该分类下的所有文章
* @param categoryId 分类ID
* @param typeid 分类ID
* @return 返回包含文章列表的ResponseMessage对象
*/
@GetMapping("/category/{categoryId}")
public ResponseMessage<List<Article>> getArticlesByCategory(@PathVariable Integer categoryId) {
return articleService.getArticlesByCategory(categoryId);
public ResponseMessage<List<Article>> getArticlesByCategory(@PathVariable Integer typeid) {
return articleService.getArticlesByCategory(typeid);
}
/**