标签:div Pageable content tco font res ogg str cti
@GetMapping
@ResponseBodypublic Object findAll(@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize, String data) {
Pageable pageable = PageRequest.of(page, pageSize, Sort.Direction.DESC, "id");
Predicate predicate = getPredicate(data);
Page<Invite> pageResult = inviteService.findByProperties(pageable, predicate);
return Response.list(pageResult.getContent(), (int) pageResult.getTotalElements());
}
page = null != page ? --page : 0;
pageSize = null != pageSize ? pageSize : 10;
Pageable pageable = PageRequest.of(page, pageSize, Sort.Direction.DESC, "id");
Predicate predicate = getPredicate(data);
Page<Invite> pageResult = inviteService.findByProperties(pageable, predicate);
List<Invite> list = inviteService.findListByProperties(predicate);
System.out.println("list====[]"+list);
logger.debug("list====={}",list);
return Response.list(pageResult.getContent(), (int) pageResult.getTotalElements())
第一种写法无法会使得Page产生错误 具体原因未知:
正确的方式:一脸懵逼 参数哪里不一样吗?
@RequestParam 注解使用是bug ,未查明问题原因 也可能是 Pageable 的原因
标签:div Pageable content tco font res ogg str cti
原文地址:https://www.cnblogs.com/slAmor/p/12900775.html