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 create(@RequestBody ProductVO productVO){ return ResultVO.buildSuccess(productService.create(productVO)); } @PostMapping("/stock") public ResultVO addStock(@RequestParam("id") Integer id,@RequestParam("number") Integer number){ return ResultVO.buildSuccess(productService.addStock(id,number)); } @GetMapping("/all") public ResultVO> getAllProducts(@RequestParam("storeId") Integer storeId){ return ResultVO.buildSuccess(productService.getAllProducts(storeId)); } }