package com.mindskip.xzs.controller.admin; import com.github.pagehelper.PageInfo; import com.mindskip.xzs.base.RestResponse; import com.mindskip.xzs.domain.Tag; import com.mindskip.xzs.domain.vo.TagVO; import com.mindskip.xzs.service.TagService; import lombok.Data; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @author gonghl * @since 2024/5/6 上午 11:45 */ @RestController @RequestMapping(value = "/api/admin/tag") @Data public class TagController { private final TagService tagService; @RequestMapping(value = "/list", method = RequestMethod.GET) public RestResponse> pageList() { List list = tagService.list(); return RestResponse.ok(list); } @RequestMapping(value = "/page/list", method = RequestMethod.POST) public RestResponse> pageList(@RequestBody TagVO tag) { PageInfo page = tagService.tagPage(tag); return RestResponse.ok(page); } @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) public RestResponse select(@PathVariable Integer id) { Tag tag = tagService.getById(id); return RestResponse.ok(tag); } @RequestMapping(value = "/selectCount/{id}", method = RequestMethod.POST) public RestResponse> selectCount(@PathVariable Integer id) { return RestResponse.ok(tagService.selectCount(id)); } @RequestMapping(value = "/edit", method = RequestMethod.POST) public RestResponse update(@RequestBody Tag tag) { tagService.saveOrUpdate(tag); return RestResponse.ok(tag); } @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) public RestResponse delete(@PathVariable Integer id) { tagService.removeById(id); return RestResponse.ok(id); } }