删除页面

返回类型是ReponseResult

 

  @ApiOperation("删除页面")
    public ResponseResult delete(String id);

 

service

 

  //根据id删除页面
    public ResponseResult delete(String id){
        //先查询一下
        Optional<CmsPage> optional = cmsPageRepository.findById(id);
        if(optional.isPresent()){
            cmsPageRepository.deleteById(id);
            return new ResponseResult(CommonCode.SUCCESS);
        }
        return new ResponseResult(CommonCode.FAIL);
        
    }

 

controller

删除用deleteMapping


@Override
@DeleteMapping("/del/{id}")
public ResponseResult delete(@PathVariable String id) {
return pageService.delete(id);
}

 

测试

在swaggerUI上测试







 

相关文章:

  • 2021-08-14
  • 2021-09-07
  • 2021-10-13
  • 2022-01-26
  • 2021-06-12
  • 2021-07-31
  • 2021-07-15
  • 2021-08-30
猜你喜欢
  • 2021-10-14
  • 2021-06-19
  • 2021-09-20
  • 2021-07-16
  • 2021-11-03
  • 2022-01-01
  • 2022-01-14
相关资源
相似解决方案