1、先看实例
@GetMapping("users")
public ResultEntity<Page<User>> getUsers(
@ModelAttribute UserSearch search) throws CommonException {
ResultEntity<Page<VehicleType>> resultEntity = userService.getUsers(search);
return resultEntity;
}
2、此实例作用:根据条件查询用户。所有条件我封装成了一个对象
3、@ModelAttribute 作用:前端用get方式传参,加此注解,自动将参数封装成对象