前端->后端:不用json
ajax不指定contentType即可=>后端不用@RequestBody,且避免了单独接收一个未封装参数的麻
统一头
@RequestMapping(value = "/users")
GET1 根据id查
@GetMapping("/{id}")
@PathVariable int id
GET2 需要条件or分页
@GetMapping("/")
UserDto userDto
POST1 插入单个
@PostMapping("/{id}")
@PathVariable int id
POST2 插入多个
@PostMapping("/")
UserDto userDto
增加PUT;删除DELETE类似
补充:Dto是封装的类,方便接收参数
UserDto继承 分页{
User实体类当作属性
}
传的时候user.实体类里的属性