diff --git a/src/main/java/com/book/demo/controller/OrderController.java b/src/main/java/com/book/demo/controller/OrderController.java index 1bd79ec..0c72eef 100644 --- a/src/main/java/com/book/demo/controller/OrderController.java +++ b/src/main/java/com/book/demo/controller/OrderController.java @@ -47,7 +47,22 @@ public class OrderController { return res; } - //更新订单 + //更新订单状态 + @ResponseBody + @GetMapping("/updateorder") + public Result updateOrder(@RequestParam("orderid")String orderid,@RequestParam("state")int states){ + int state=orderMapper.updateOrder(orderid,states); + if(state>0){ + res.setCode(0); + res.setMsg("更新订单成功"); + } + else{ + res.setCode(-1); + res.setMsg("更新订单失败"); + } + res.data=null; + return res; + } //生成订单>>主键设为自增,state默认设为0 @ResponseBody @@ -68,5 +83,20 @@ public class OrderController { return res; } - //删除订单 + //删除订单>>根据订单号删除对应订单 + @ResponseBody + @GetMapping("/deleteorder") + public Result deleteOrder(@RequestParam("orderid")String orderid){ + int state=orderMapper.deleteOrder(orderid); + if(state>0){ + res.setCode(0); + res.setMsg("删除订单成功"); + } + else{ + res.setCode(-1); + res.setMsg("删除订单失败"); + } + res.data=null; + return res; + } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e523296..1e773f9 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.port=8090 +server.port=8099 spring.datasource.url=jdbc:mysql://localhost:3306/bookstore?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8