---操作 /user 為例
1--增(Post)
@RequestMapping
@RequestMapping(value = "/user",method = RequestMethod.POST)
@PostMapping
@PostMapping("/user")
public String insert() {
System.out.println("用戶新增");
return "";
}
2--刪(Delete)
@RequestMapping
@RequestMapping(value = "/user",method = RequestMethod.DELETE)
@DeleteMapping
@DeleteMapping("/user")
public String delete() {
System.out.println("用戶刪除");
return "";
}
3--改(Put/Patch)
put ----- 是對整體的修改
patch ----- 是對局部的修改
@RequestMapping
@RequestMapping(value = "/user",method = RequestMethod.PUT)
@PutMapping
@PutMapping("/user")
public String update() {
System.out.println("用戶更新");
return "";
}
@PatchMapping
@PtachMapping("/user")
public String update() {
System.out.println("用戶更新");
return "";
}
4--查(Get)
@RequestMapping
@RequestMapping(value = "/user",method = RequestMethod.GET)
@GetMapping
@GetMapping("/user")
public String select() {
System.out.println("用戶查詢");
return "";
}
