基本操作
#类级别的注解
@Controller
@RestController
@RequestMapping("/hello")
#springMVC常用方法级别注解
@ResponseBody
@GetMapping()
@GetMapping("/treeData")
@GetMapping("/add/{parentId}")
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
@PostMapping("/list")
@PostMapping("/checkRoleKeyUnique")
@DeleteMapping("/{userId}")
@PutMapping("/update")
参数级别的
@PathVariable("deptId") Long deptId
@PathVariable(value = "excludeId", required = false) Long excludeId
@PathVariable(value = "excludeId", required = false) String excludeId
@Validated
@Validated在controller层打在形参上,开启了jr303校验,校验字段在实体类字段上
视图在解析参数时会执行校验
中级操作
get请求,携带的参数是数组的情况