删除页面
用户操作流程:
1、用户进入用户列表,点击“删除”
2、执行删除操作,提示“删除成功”或“删除失败”
删除页面接口定义
@ApiOperation("通过ID删除页面")
public ResponseResult delete(String id);
删除页面服务端开发
Dao
使用 Spring Data提供的deleteById方法完成删除操作 。
Service
//删除页面
public ResponseResult delete(String id){
CmsPage one = this.getById(id);
if(one!=null){
//删除页面
cmsPageRepository.deleteById(id);
return new ResponseResult(CommonCode.SUCCESS);
}
return new ResponseResult(CommonCode.FAIL);
}
Controller
@DeleteMapping("/del/{id}") //使用http的delete方法完成岗位操作
public ResponseResult delete(@PathVariable("id") String id) {
return pageService.delete(id);
}