| 123456789101112131415161718192021222324252627282930313233343536373839 |
- package com.seecoder.BlueWhale.Controller;
- import com.seecoder.BlueWhale.Service.ProductService;
- import com.seecoder.BlueWhale.VO.ProductVO;
- import com.seecoder.BlueWhale.VO.ResultVO;
- import java.util.List;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- @RestController
- @RequestMapping("/api/product")
- public class ProductController {
- @Autowired
- ProductService productService;
- @PostMapping("/create")
- 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){
- return ResultVO.buildSuccess(productService.addStock(id,number));
- }
- @GetMapping("/all")
- public ResultVO<List<ProductVO>> getAllProducts(@RequestParam("storeId") Integer storeId){
- return ResultVO.buildSuccess(productService.getAllProducts(storeId));
- }
- }
|