fix: api parameter names in the post list content api. (#1415)

pull/1414/head
Ryan Wang 2021-07-11 23:49:20 +08:00 committed by GitHub
parent 878e7155a8
commit 02e4b88288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -65,13 +65,14 @@ public class PostController {
} }
//CS304 issue for https://github.com/halo-dev/halo/issues/1351 //CS304 issue for https://github.com/halo-dev/halo/issues/1351
/** /**
* Enable users search published articles with keywords * Enable users search published articles with keywords
* *
* @param pageable store the priority of the sort algorithm * @param pageable store the priority of the sort algorithm
* @param keyword search articles with keyword * @param keyword search articles with keyword
* @param categoryid search articles with categoryid * @param categoryId search articles with categoryId
* @return published articles that contains keywords and specific categoryid * @return published articles that contains keywords and specific categoryid
*/ */
@GetMapping @GetMapping
@ -79,10 +80,10 @@ public class PostController {
public Page<PostListVO> pageBy( public Page<PostListVO> pageBy(
@PageableDefault(sort = {"topPriority", "createTime"}, direction = DESC) Pageable pageable, @PageableDefault(sort = {"topPriority", "createTime"}, direction = DESC) Pageable pageable,
@RequestParam(value = "keyword") String keyword, @RequestParam(value = "keyword") String keyword,
@RequestParam(value = "categoryid") int categoryid) { @RequestParam(value = "categoryId") Integer categoryId) {
PostQuery postQuery = new PostQuery(); PostQuery postQuery = new PostQuery();
postQuery.setKeyword(keyword); postQuery.setKeyword(keyword);
postQuery.setCategoryId(categoryid); postQuery.setCategoryId(categoryId);
postQuery.setStatus(PostStatus.PUBLISHED); postQuery.setStatus(PostStatus.PUBLISHED);
Page<Post> postPage = postService.pageBy(postQuery, pageable); Page<Post> postPage = postService.pageBy(postQuery, pageable);
return postService.convertToListVo(postPage, true); return postService.convertToListVo(postPage, true);