常用注解@PageableDefault
程序员文章站
2022-04-05 21:15:52
...
@RequestParam 映射请求参数到 java方法的参数
@PageableDefault 指定参数分页默认值
@PageableDefault 指定参数分页默认值
import org.springframework.data.domain.Pageable; @GetMapping public List<User> query(UserQueryCondition condition, Pageable pageable) { System.out.println(ReflectionToStringBuilder.toString(condition, ToStringStyle.MULTI_LINE_STYLE)); System.out.println(pageable.getPageSize()); System.out.println(pageable.getPageNumber()); System.out.println(pageable.getSort()); ArrayList<User> users = Lists.newArrayList(); users.add(new User()); users.add(new User()); users.add(new User()); return users; }