1. Get Method
1.1 @ApiParam
使用此注解传不传参都能运行
@GetMapping("/getResult")
public String getResult(@ApiParam("用户名") String username){
return "hello,your name is:"+ username;
}
1.2 @RequestParam
强制传参
@GetMapping ("/get")
public String getResult(@ApiParam("用户名") @RequestParam String username, @ApiParam("密码") @RequestParam String password){
return "hello,username is :"+username+" and password is :"+password;
}
1.3 地址携带参数
@GetMapping ("/hello/{username}/{password}")
public String hello(@ApiParam("用户名") @PathVariable String username, @ApiParam("密码") @PathVariable String password){
return "hello,username is :"+username+" and password is :"+password;
}
2. Post Method
@PostMapping("/status/{status}")
public R<String> status(@PathVariable int status,@RequestParam User user){
xxxxxxx;
}
3. Awakening
在一秒钟内看到本质的人和花半辈子也看不清一件事本质的人,自然是不一样的命运。