1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package com.nosum.deliver.category.controller;
- import com.nosum.common.annotation.LoginRequired;
- import com.nosum.common.base.domain.Result;
- import com.nosum.common.util.ThrowableUtils;
- import com.nosum.common.validator.group.Insert;
- import com.nosum.common.validator.group.Update;
- import com.nosum.deliver.category.domain.vo.TagsVO;
- import com.nosum.deliver.category.service.TagsService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.BindingResult;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * @author sumbytes
- * @since 2019-08-28
- */
- @RestController
- @RequestMapping("/tags")
- public class TagsController {
- @Autowired
- private TagsService tagsService;
- @GetMapping("/tags/v1/list")
- public Result getTagsList(TagsVO tagsVO) {
- return this.tagsService.getTagsList(tagsVO);
- }
- @GetMapping("/tags-article-quantity/v1/list")
- public Result getTagsAndArticleQuantityList(TagsVO tagsVO, BindingResult result) {
- ThrowableUtils.checkParamArgument(result);
- return this.tagsService.getTagsAndArticleQuantityList(tagsVO);
- }
- @GetMapping("/tags/v1/{id}")
- public Result getTags(@PathVariable Long id) {
- return this.tagsService.getTags(id);
- }
- @LoginRequired
- @PostMapping("/tags/v1/add")
- public Result saveTags(@Validated({Insert.class}) @RequestBody TagsVO tagsVO,BindingResult result) {
- ThrowableUtils.checkParamArgument(result);
- return this.tagsService.saveTags(tagsVO);
- }
- @LoginRequired
- @PutMapping("/tags/v1/update")
- public Result updateTags(@Validated({Update.class}) @RequestBody TagsVO tagsVO,BindingResult result) {
- ThrowableUtils.checkParamArgument(result);
- return this.tagsService.updateTags(tagsVO);
- }
- @LoginRequired
- @DeleteMapping("/tags/v1/{id}")
- public Result updateTags(@PathVariable Long id) {
- return this.tagsService.deleteTags(id);
- }
- }
|