提交代码

master
胡锐 2 months ago
parent 2d7bf81fd5
commit 529a743a02
  1. 26
      bweb/src/main/java/com/bweb/controller/CmsController.java

@ -135,6 +135,32 @@ public class CmsController {
} }
} }
@RequestMapping(value="/delete",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData delete(@RequestBody CmsContent body) {
try {
if (body == null || body.getId() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
// 查询内容
CmsContent cmsContent = cmsContentService.getDetail(body.getId());
if (cmsContent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据");
}
if (!CmsStatusEnum.status1.getStatus().equals(cmsContent.getStatus())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法删除,状态错误");
}
cmsContent.setStatus(CmsStatusEnum.status0.getStatus());
cmsContentService.editData(cmsContent);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDetail",method = RequestMethod.GET) @RequestMapping(value="/getDetail",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询详情") @ApiOperation(value = "查询详情")

Loading…
Cancel
Save