Browse Source

refactor: rest url修改

fanyanpeng 2 years ago
parent
commit
a3b820f824

+ 3 - 1
src/main/java/com/seecoder/BlueWhale/Controller/ProductController.java

@@ -9,12 +9,14 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 @RestController
-@RequestMapping("/api/product")
+@RequestMapping("/api/product")  // todo: products
 public class ProductController {
 
     @Autowired
     ProductService productService;
 
+// todo: 按照REST规范,资源使用复数,对于新建对象
+// 直接使用@PostMapping("")
     @PostMapping("/create")
     public ResultVO<Boolean> create(@RequestBody ProductVO productVO){
         return ResultVO.buildSuccess(productService.create(productVO));

+ 1 - 0
src/main/java/com/seecoder/BlueWhale/Controller/StoreController.java

@@ -12,6 +12,7 @@ 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;
+// todo: RESTful改造
 
 @RestController
 @RequestMapping("/api/store")

+ 1 - 1
src/main/java/com/seecoder/BlueWhale/Controller/ToolController.java

@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
-
+// todo: RESTful改造
 @RestController
 @RequestMapping("/api/tool")
 public class ToolController {

+ 1 - 0
src/main/java/com/seecoder/BlueWhale/Controller/UserController.java

@@ -5,6 +5,7 @@ import com.seecoder.BlueWhale.VO.ResultVO;
 import com.seecoder.BlueWhale.VO.UserVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+// todo: RESTful改造
 
 @RestController
 @RequestMapping("/api/user")