@RequestParam,接收get或者post方式的前端参数。如果前端传递的参数和后端你接受的参数的字段名称是一致的可以省略不写,也可以直接写@RequestParam String id,如下面的接收前端传过来的id。这种情况参数不会拼接在URL上面。
@GetMapping("xxx/xxx") public RequestResult get( @ApiParam(name = "id", value = "主键", required = true) String id){}
@PathVariable,主要是用get方式接参,参数拼接在url后面。
@GetMapping("xxx/xxx/{id}") public RequestResult get( @ApiParam(name = "id", value = "主键", required = true) @PathVariable("id") String id) {}
@ApiParam只是用于生成swagger的文档注释参数而已。