feat(分类属性): 实现分类属性管理功能
新增分类属性相关实体、DTO、仓库、服务及控制器 扩展文章服务以支持按属性查询文章 重构文章实体将typeid改为attributeid 添加按标题查询文章功能
This commit is contained in:
@@ -42,6 +42,15 @@ public class ArticleController {
|
||||
public ResponseMessage<List<Article>> getAllArticles() {
|
||||
return articleService.getAllArticles();
|
||||
}
|
||||
/**
|
||||
* 根据标题查询文章列表
|
||||
* @param title 文章标题
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/title/{title}")
|
||||
public ResponseMessage<List<Article>> getArticlesByTitle(@PathVariable String title) {
|
||||
return articleService.getArticlesByTitle(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建新文章
|
||||
@@ -84,13 +93,33 @@ public class ArticleController {
|
||||
|
||||
|
||||
/**
|
||||
* 根据分类ID获取该分类下的所有文章
|
||||
* @param typeid 分类ID
|
||||
* 根据分类ID获取该分类下的所有文章(兼容旧接口)
|
||||
* @param categoryId 分类ID
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/category/{categoryId}")
|
||||
public ResponseMessage<List<Article>> getArticlesByCategory(@PathVariable Integer typeid) {
|
||||
return articleService.getArticlesByCategory(typeid);
|
||||
public ResponseMessage<List<Article>> getArticlesByCategory(@PathVariable Integer categoryId) {
|
||||
return articleService.getArticlesByCategory(categoryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性ID获取该属性下的所有文章
|
||||
* @param attributeId 属性ID
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/attribute/{attributeId}")
|
||||
public ResponseMessage<List<Article>> getArticlesByAttribute(@PathVariable Integer attributeId) {
|
||||
return articleService.getArticlesByAttribute(attributeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性ID获取最新文章(按创建时间降序)
|
||||
* @param attributeId 属性ID
|
||||
* @return 返回包含最新文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/attribute/{attributeId}/latest")
|
||||
public ResponseMessage<List<Article>> getLatestArticlesByAttribute(@PathVariable Integer attributeId) {
|
||||
return articleService.getLatestArticlesByAttribute(attributeId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user