|
|
|
@ -5,7 +5,7 @@ import com.luoo.tag.pojo.TagDTO;
|
|
|
|
|
import com.luoo.tag.pojo.TagQueryReq;
|
|
|
|
|
import com.luoo.tag.pojo.TagUpdateReq;
|
|
|
|
|
import com.luoo.tag.service.TagService;
|
|
|
|
|
import entity.ResultVO;
|
|
|
|
|
import api.Result;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
@ -32,23 +32,23 @@ public class TagController {
|
|
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页码", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页数", required = true) })
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public ResultVO<Page<TagDTO>> getById(@Validated TagQueryReq queryReq) {
|
|
|
|
|
return ResultVO.success(tagService.queryPage(queryReq));
|
|
|
|
|
public Result<Page<TagDTO>> getById(@Validated TagQueryReq queryReq) {
|
|
|
|
|
return Result.success(tagService.queryPage(queryReq));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询标签详情", notes = "查询标签详情")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
|
public ResultVO<TagDTO> getById(@PathVariable String id) {
|
|
|
|
|
return ResultVO.success(tagService.queryById(id));
|
|
|
|
|
public Result<TagDTO> getById(@PathVariable String id) {
|
|
|
|
|
return Result.success(tagService.queryById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "新增标签信息", notes = "新增标签信息")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "createReq", value = "创建参数", required = true) })
|
|
|
|
|
@PostMapping
|
|
|
|
|
public ResultVO<Void> create(@Validated @RequestBody TagCreateReq createReq) {
|
|
|
|
|
public Result<Void> create(@Validated @RequestBody TagCreateReq createReq) {
|
|
|
|
|
tagService.create(createReq);
|
|
|
|
|
return ResultVO.success("创建成功");
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "更新标签信息", notes = "更新标签信息")
|
|
|
|
@ -56,10 +56,10 @@ public class TagController {
|
|
|
|
|
@ApiImplicitParam(name = "updateReq", value = "更新参数", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "标签ID", required = true) })
|
|
|
|
|
@PutMapping("/{id}")
|
|
|
|
|
public ResultVO<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id) {
|
|
|
|
|
public Result<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id) {
|
|
|
|
|
updateReq.setId(id);
|
|
|
|
|
tagService.update(updateReq);
|
|
|
|
|
return ResultVO.success("更新成功");
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "更新标签状态", notes = "更新标签状态")
|
|
|
|
@ -67,16 +67,16 @@ public class TagController {
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "标签ID", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "state", value = "标签状态", required = true) })
|
|
|
|
|
@PutMapping("/status/{id}")
|
|
|
|
|
public ResultVO<Void> updateStatus(@PathVariable String id, @RequestParam Integer state) {
|
|
|
|
|
public Result<Void> updateStatus(@PathVariable String id, @RequestParam Integer state) {
|
|
|
|
|
tagService.updateState(id, state);
|
|
|
|
|
return ResultVO.success("状态更新成功");
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "删除标签", notes = "删除标签")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
|
|
public ResultVO<Void> delete(@PathVariable String id) {
|
|
|
|
|
public Result<Void> delete(@PathVariable String id) {
|
|
|
|
|
tagService.delete(id);
|
|
|
|
|
return ResultVO.success("删除成功");
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|