|
@@ -3,6 +3,7 @@ package com.yonge.cooleshow.admin.controller;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.MusicTagSaveDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.MusicTagSearch;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.MusicTag;
|
|
|
import com.yonge.cooleshow.biz.dal.service.MusicTagService;
|
|
|
import com.yonge.cooleshow.biz.dal.support.PageUtil;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.MusicTagVo;
|
|
@@ -64,6 +65,12 @@ public class MusicTagController extends BaseController {
|
|
|
@PostMapping(value = "/save", consumes="application/json", produces="application/json")
|
|
|
@ApiOperation(value = "新增", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
public HttpResponseResult<Boolean> save(@Validated(MusicTagSaveDto.Create.class) @RequestBody MusicTagSaveDto musicTagSaveDto) {
|
|
|
+ if (musicTagSaveDto.getParentTagId() != null && musicTagSaveDto.getParentTagId() != 0) {
|
|
|
+ MusicTag musicTag = musicTagService.getById(musicTagSaveDto.getParentTagId());
|
|
|
+ if (musicTag.getParentTagId() != 0) {
|
|
|
+ return failed("标签只能有两级");
|
|
|
+ }
|
|
|
+ }
|
|
|
return succeed(musicTagService.createMusicTag(musicTagSaveDto));
|
|
|
}
|
|
|
|
|
@@ -73,15 +80,21 @@ public class MusicTagController extends BaseController {
|
|
|
@PostMapping(value = "/update", consumes="application/json", produces="application/json")
|
|
|
@ApiOperation(value = "修改", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
public HttpResponseResult<Boolean> update(@Validated(MusicTagSaveDto.Update.class) @RequestBody MusicTagSaveDto musicTagSaveDto) {
|
|
|
+ if (musicTagSaveDto.getParentTagId() != null && musicTagSaveDto.getParentTagId() != 0) {
|
|
|
+ MusicTag musicTag = musicTagService.getById(musicTagSaveDto.getParentTagId());
|
|
|
+ if (musicTag.getParentTagId() != 0) {
|
|
|
+ return failed("标签只能有两级");
|
|
|
+ }
|
|
|
+ }
|
|
|
return succeed(musicTagService.updateMusicTag(musicTagSaveDto));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除
|
|
|
*/
|
|
|
- @PostMapping("/remove")
|
|
|
+ @PostMapping("/remove/{id}")
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入id")
|
|
|
- public HttpResponseResult<Boolean> remove(@ApiParam(value = "标签编号", required = true) @RequestParam Long id) {
|
|
|
+ public HttpResponseResult<Boolean> remove(@ApiParam(value = "标签编号", required = true) @PathVariable Long id) {
|
|
|
if (StringUtil.isEmpty(id)) {
|
|
|
return failed("参数不能为空");
|
|
|
}
|
|
@@ -91,9 +104,9 @@ public class MusicTagController extends BaseController {
|
|
|
/**
|
|
|
* 启用/停用
|
|
|
*/
|
|
|
- @PostMapping("/state")
|
|
|
+ @PostMapping("/state/{id}")
|
|
|
@ApiOperation(value = "启用/停用", notes = "传入id")
|
|
|
- public HttpResponseResult<Boolean> state(@ApiParam(value = "标签编号", required = true) @RequestParam Long id) {
|
|
|
+ public HttpResponseResult<Boolean> state(@ApiParam(value = "标签编号", required = true) @PathVariable Long id) {
|
|
|
if (StringUtil.isEmpty(id)) {
|
|
|
return failed("参数不能为空");
|
|
|
}
|