提交 a8eb8895 编写于 作者: J johnniang

Refactor listTags api

上级 836e9975
......@@ -70,7 +70,7 @@ public class CommentController {
}
@PutMapping("{commentId:\\d+}/status/{status}")
@ApiOperation("Update comment status")
@ApiOperation("Updates comment status")
public CommentOutputDTO updateStatusBy(@PathVariable("commentId") Long commentId,
@PathVariable("status") CommentStatus status) {
// Update comment status
......@@ -80,6 +80,7 @@ public class CommentController {
}
@DeleteMapping("{commentId:\\d+}")
@ApiOperation("Deletes comment permanently and recursively")
public CommentOutputDTO deleteBy(@PathVariable("commentId") Long commentId) {
// Get comment by id
Comment comment = commentService.getById(commentId);
......
......@@ -39,23 +39,23 @@ public class GalleryController {
/**
* Get gallery by id.
*
* @param id gallery id
* @param galleryId gallery id
* @return GalleryOutputDTO
*/
@GetMapping("{id:\\d+}")
@GetMapping("{galleryId:\\d+}")
@ApiOperation("Get gallery detail by id")
public GalleryOutputDTO getBy(@PathVariable("id") Integer id) {
return new GalleryOutputDTO().convertFrom(galleryService.getById(id));
public GalleryOutputDTO getBy(@PathVariable("galleryId") Integer galleryId) {
return new GalleryOutputDTO().convertFrom(galleryService.getById(galleryId));
}
/**
* Delete gallery by id.
*
* @param id id
* @param galleryId gallery id
*/
@DeleteMapping("{id:\\d+}")
@DeleteMapping("{galleryId:\\d+}")
@ApiOperation("Delete gallery by id")
public void deletePermanently(@PathVariable("id") Integer id) {
galleryService.removeById(id);
public void deletePermanently(@PathVariable("galleryId") Integer galleryId) {
galleryService.removeById(galleryId);
}
}
......@@ -63,9 +63,9 @@ public class PostController {
@GetMapping("status/{status}")
@ApiOperation("Gets a page of post by post status")
public Page<? extends PostSimpleOutputDTO> pageByStatus(@PathVariable(name = "status") PostStatus status,
@RequestParam(value = "more_info", required = false, defaultValue = "false") Boolean moreInfo,
@RequestParam(value = "more", required = false, defaultValue = "false") Boolean more,
@PageableDefault(sort = "updateTime", direction = DESC) Pageable pageable) {
if (moreInfo) {
if (more) {
return postService.pageListVoBy(status, pageable);
}
return postService.pageSimpleDtoByStatus(status, pageable);
......
package cc.ryanc.halo.web.controller.admin.api;
import cc.ryanc.halo.model.dto.TagOutputDTO;
import cc.ryanc.halo.model.dto.TagWithCountOutputDTO;
import cc.ryanc.halo.model.entity.Tag;
import cc.ryanc.halo.model.params.TagParam;
import cc.ryanc.halo.service.PostTagService;
......@@ -36,13 +35,12 @@ public class TagController {
this.postTagService = postTagService;
}
@GetMapping("/addition")
public List<TagWithCountOutputDTO> listTagsWithCount(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) {
return postTagService.listTagWithCountDtos(sort);
}
@GetMapping
public List<TagOutputDTO> listTags(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) {
public List<? extends TagOutputDTO> listTags(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort,
@RequestParam(name = "more", required = false, defaultValue = "false") Boolean more) {
if (more) {
return postTagService.listTagWithCountDtos(sort);
}
return tagService.convertTo(tagService.listAll(sort));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册