fangmingyue 2 years ago
parent
commit
9cee293a08

BIN
db/ybai.db View File


+ 8
- 4
src/main/java/com/yunzhi/inte/controller/DishesController.java View File

67
      */
67
      */
68
     @ApiOperation("新增数据")
68
     @ApiOperation("新增数据")
69
     @PostMapping("/dishes")
69
     @PostMapping("/dishes")
70
-    public ResponseBean add(Dishes dishes) throws Exception {
70
+    public ResponseBean add(@ApiParam("对象实例") @RequestBody Dishes dishes) throws Exception {
71
         dishesService.save(dishes);
71
         dishesService.save(dishes);
72
         return ResponseBean.success(dishes);
72
         return ResponseBean.success(dishes);
73
     }
73
     }
80
      */
80
      */
81
     @ApiOperation("更新数据")
81
     @ApiOperation("更新数据")
82
     @PutMapping("/dishes/{id}")
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
         return ResponseBean.success(dishes);
88
         return ResponseBean.success(dishes);
86
     }
89
     }
87
 
90
 
94
     @ApiOperation("通过主键删除数据")
97
     @ApiOperation("通过主键删除数据")
95
     @DeleteMapping("/dishes/{id}")
98
     @DeleteMapping("/dishes/{id}")
96
     public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
99
     public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable Integer id){
97
-        dishesService.removeLogicById(id);
100
+//        dishesService.removeLogicById(id);
101
+        dishesService.removeById(id);
98
         return ResponseBean.success("success");
102
         return ResponseBean.success("success");
99
     }
103
     }
100
 }
104
 }

+ 1
- 1
src/main/java/com/yunzhi/inte/entity/Dishes.java View File

24
 public class Dishes implements Serializable,Cloneable{
24
 public class Dishes implements Serializable,Cloneable{
25
     /** 菜肴ID */
25
     /** 菜肴ID */
26
     @ApiModelProperty(name = "菜肴ID",notes = "")
26
     @ApiModelProperty(name = "菜肴ID",notes = "")
27
-    @TableId(value = "id", type = IdType.INPUT)
27
+    @TableId(value = "id", type = IdType.AUTO)
28
     private Integer id ;
28
     private Integer id ;
29
     /** 菜肴名称 */
29
     /** 菜肴名称 */
30
     @ApiModelProperty(name = "菜肴名称",notes = "")
30
     @ApiModelProperty(name = "菜肴名称",notes = "")

+ 1
- 1
src/main/resources/application.yml View File

7
 spring:
7
 spring:
8
   datasource:
8
   datasource:
9
     driver-class-name: org.sqlite.JDBC
9
     driver-class-name: org.sqlite.JDBC
10
-    url: jdbc:sqlite:E:\work\jgz\service\db\ybai.db
10
+    url: jdbc:sqlite:E:\work\jungongzhang\service\db\ybai.db
11
     username:
11
     username:
12
     password:
12
     password:
13
   application:
13
   application: