Complete listTags api

pull/137/head
johnniang 2019-03-21 10:57:59 +08:00
parent 2f15a34520
commit 338dbd623e
2 changed files with 13 additions and 4 deletions

View File

@ -1,8 +1,11 @@
package cc.ryanc.halo.service; package cc.ryanc.halo.service;
import cc.ryanc.halo.model.dto.TagOutputDTO;
import cc.ryanc.halo.model.entity.Tag; import cc.ryanc.halo.model.entity.Tag;
import cc.ryanc.halo.service.base.CrudService; import cc.ryanc.halo.service.base.CrudService;
import java.util.List;
/** /**
* Tag service. * Tag service.
@ -17,4 +20,5 @@ public interface TagService extends CrudService<Tag, Integer> {
* @param id id * @param id id
*/ */
void remove(Integer id); void remove(Integer id);
} }

View File

@ -1,8 +1,10 @@
package cc.ryanc.halo.web.controller.admin.api; package cc.ryanc.halo.web.controller.admin.api;
import cc.ryanc.halo.model.dto.TagOutputDTO; 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.entity.Tag;
import cc.ryanc.halo.model.params.TagParam; import cc.ryanc.halo.model.params.TagParam;
import cc.ryanc.halo.service.PostTagService;
import cc.ryanc.halo.service.TagService; import cc.ryanc.halo.service.TagService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
@ -25,14 +27,17 @@ public class TagController {
private final TagService tagService; private final TagService tagService;
public TagController(TagService tagService) { private final PostTagService postTagService;
public TagController(TagService tagService,
PostTagService postTagService) {
this.tagService = tagService; this.tagService = tagService;
this.postTagService = postTagService;
} }
@GetMapping @GetMapping
public List<TagOutputDTO> listTags(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) { public List<TagWithCountOutputDTO> listTags(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) {
return postTagService.listTagWithCountDtos(sort);
return null;
} }
@PostMapping @PostMapping