refactor(pojo): 修正Article类中attributeid字段的列名拼写
feat(controller): 在ArticleController中添加根据属性ID获取文章的方法 style(repository): 在CategoryRepository方法上添加空行提高可读性 chore: 移除MyAfterProjecyApplication中多余的MapperScan注解
This commit is contained in:
@@ -52,6 +52,47 @@ public class ArticleController {
|
||||
return articleService.getArticlesByTitle(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性ID获取该属性下的所有文章
|
||||
* @param attributeId 属性ID
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/attribute/{attributeId}")
|
||||
public ResponseMessage<List<Article>> getArticlesByAttribute(@PathVariable Integer attributeId) {
|
||||
return articleService.getArticlesByAttribute(attributeId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据分类ID获取该分类下的所有文章(兼容旧接口)
|
||||
* @param categoryId 分类ID
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/category/{categoryId}")
|
||||
public ResponseMessage<List<Article>> getArticlesByCategory(@PathVariable Integer categoryId) {
|
||||
return articleService.getArticlesByCategory(categoryId);
|
||||
}
|
||||
/**
|
||||
* 根据属性ID获取最新文章(按创建时间降序)
|
||||
* @param attributeId 属性ID
|
||||
* @return 返回包含最新文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/attribute/{attributeId}/latest")
|
||||
public ResponseMessage<List<Article>> getLatestArticlesByAttribute(@PathVariable Integer attributeId) {
|
||||
return articleService.getLatestArticlesByAttribute(attributeId);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return ar
|
||||
*/
|
||||
/**
|
||||
* 获取浏览量最高的文章列表
|
||||
* @return 返回包含热门文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/popular")
|
||||
public ResponseMessage<List<Article>> getMostViewedArticles() {
|
||||
return articleService.getMostViewedArticles();
|
||||
}
|
||||
/**
|
||||
* 创建新文章
|
||||
* 仅限AUTHOR角色用户访问
|
||||
@@ -91,43 +132,4 @@ public class ArticleController {
|
||||
return articleService.deleteArticle(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据分类ID获取该分类下的所有文章(兼容旧接口)
|
||||
* @param categoryId 分类ID
|
||||
* @return 返回包含文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/category/{categoryId}")
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取浏览量最高的文章列表
|
||||
* @return 返回包含热门文章列表的ResponseMessage对象
|
||||
*/
|
||||
@GetMapping("/popular")
|
||||
public ResponseMessage<List<Article>> getMostViewedArticles() {
|
||||
return articleService.getMostViewedArticles();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user