|
|
@@ -1,31 +1,31 @@
|
|
|
-package com.seecoder.BlueWhale.Controller;
|
|
|
+package com.seecoder.BlueWhale.controller;
|
|
|
|
|
|
-import com.seecoder.BlueWhale.Service.ProductService;
|
|
|
-import com.seecoder.BlueWhale.VO.ProductVO;
|
|
|
-import com.seecoder.BlueWhale.VO.ResultVO;
|
|
|
+import com.seecoder.BlueWhale.service.ProductService;
|
|
|
+import com.seecoder.BlueWhale.vo.ProductVO;
|
|
|
+import com.seecoder.BlueWhale.vo.ResultVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
-@RequestMapping("/api/product")
|
|
|
+@RequestMapping("/api/products")
|
|
|
public class ProductController {
|
|
|
|
|
|
@Autowired
|
|
|
ProductService productService;
|
|
|
|
|
|
- @PostMapping("/create")
|
|
|
+ @PostMapping()
|
|
|
public ResultVO<Boolean> create(@RequestBody ProductVO productVO){
|
|
|
return ResultVO.buildSuccess(productService.create(productVO));
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/stock")
|
|
|
- public ResultVO<Boolean> addStock(@RequestParam("id") Integer id,@RequestParam("number") Integer number){
|
|
|
+ @PostMapping("/{id}/stock")
|
|
|
+ public ResultVO<Boolean> addStock(@PathVariable(value = "id") Integer id,@RequestParam("number") Integer number){
|
|
|
return ResultVO.buildSuccess(productService.addStock(id,number));
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/all")
|
|
|
+ @GetMapping()
|
|
|
public ResultVO<List<ProductVO>> getAllProducts(@RequestParam("storeId") Integer storeId){
|
|
|
return ResultVO.buildSuccess(productService.getAllProducts(storeId));
|
|
|
}
|