①添加后需要在url中携带参数才能执行方法
②不加的话需要前后端变量名保持一致才能生效
③@RequestParam(required = false)设置为非必传
@GetMapping
public Result<PageBean<Article>> list(Integer pageNum,
Integer pageSize,
@RequestParam(required = false) Integer categoryId,
@RequestParam(required = false) String state){
PageBean<Article> pageBean =
articleService.list(pageNum,pageSize,categoryId,state);
return Result.success(pageBean);
}
④RequestParam(defaultValue = “0”)指定参数默认值
⑤可以通过@RequestParam(“userId”)或者@RequestParam(value = “userId”)指定传入的参数名(最重要的作用)