| 12345678910111213141516171819202122232425262728293031323334353637 |
- package com.seecoder.BlueWhale.controller;
- 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.RestController;
- import com.seecoder.BlueWhale.service.StoreService;
- import com.seecoder.BlueWhale.vo.ResultVO;
- import com.seecoder.BlueWhale.vo.StoreVO;
- @RestController
- @RequestMapping("/api/stores")
- public class StoreController {
-
- @Autowired
- StoreService storeService;
- @PostMapping()
- public ResultVO<Boolean> create(@RequestBody StoreVO storeVO){
- return ResultVO.buildSuccess(storeService.create(storeVO));
- }
- @GetMapping("/{id}")
- public ResultVO<StoreVO> getStore(@PathVariable(value = "id") Integer id){
- return ResultVO.buildSuccess(storeService.getStore(id));
- }
- @GetMapping
- public ResultVO<List<StoreVO>> getAllStores(){
- return ResultVO.buildSuccess(storeService.getAllStores());
- }
- }
|