|
|
@@ -1,9 +1,12 @@
|
|
|
package com.seecoder.BlueWhale.controller;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import com.seecoder.BlueWhale.service.OrderService;
|
|
|
+import com.seecoder.BlueWhale.util.SecurityUtil;
|
|
|
import com.seecoder.BlueWhale.vo.OrderVO;
|
|
|
import com.seecoder.BlueWhale.vo.ResultVO;
|
|
|
|
|
|
@@ -14,8 +17,17 @@ public class OrderController {
|
|
|
@Autowired
|
|
|
OrderService orderService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SecurityUtil securityUtil;
|
|
|
+
|
|
|
@PostMapping
|
|
|
public ResultVO<Boolean> create(@RequestBody OrderVO orderVO){
|
|
|
return ResultVO.buildSuccess(orderService.create(orderVO));
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping
|
|
|
+ public ResultVO<List<OrderVO>> getAllOrders(){
|
|
|
+ Integer userId = securityUtil.getCurrentUser().getId();
|
|
|
+ return ResultVO.buildSuccess(orderService.getAllOrders(userId));
|
|
|
+ }
|
|
|
}
|