|
@@ -67,7 +67,7 @@ public class DishesController extends BaseController {
|
67
|
67
|
*/
|
68
|
68
|
@ApiOperation("新增数据")
|
69
|
69
|
@PostMapping("/dishes")
|
70
|
|
- public ResponseBean add(Dishes dishes) throws Exception {
|
|
70
|
+ public ResponseBean add(@ApiParam("对象实例") @RequestBody Dishes dishes) throws Exception {
|
71
|
71
|
dishesService.save(dishes);
|
72
|
72
|
return ResponseBean.success(dishes);
|
73
|
73
|
}
|
|
@@ -80,8 +80,11 @@ public class DishesController extends BaseController {
|
80
|
80
|
*/
|
81
|
81
|
@ApiOperation("更新数据")
|
82
|
82
|
@PutMapping("/dishes/{id}")
|
83
|
|
- public ResponseBean edit(Dishes dishes) throws Exception {
|
84
|
|
- dishesService.updateById(dishes);
|
|
83
|
+ public ResponseBean edit(@ApiParam("对象ID") @PathVariable Integer id, @ApiParam("对象实例") @RequestBody Dishes dishes) throws Exception {
|
|
84
|
+ dishes.setId(id);
|
|
85
|
+ if(dishesService.updateById(dishes)){
|
|
86
|
+ dishesService.getById(id);
|
|
87
|
+ }
|
85
|
88
|
return ResponseBean.success(dishes);
|
86
|
89
|
}
|
87
|
90
|
|
|
@@ -94,7 +97,8 @@ public class DishesController extends BaseController {
|
94
|
97
|
@ApiOperation("通过主键删除数据")
|
95
|
98
|
@DeleteMapping("/dishes/{id}")
|
96
|
99
|
public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
|
97
|
|
- dishesService.removeLogicById(id);
|
|
100
|
+
|
|
101
|
+ dishesService.removeById(id);
|
98
|
102
|
return ResponseBean.success("success");
|
99
|
103
|
}
|
100
|
104
|
}
|