public Page<Student> getpage(final Integer id, int page, int size) {
Pageable pageable = new PageRequest(page, size, new Sort("id"));
Specification<Student> spec = new Specification<Student>() {
public Predicate toPredicate(Root<Student> root,
CriteriaQuery<?> query, CriteriaBuilder cb) {
return query.where(cb.lt(root.get("id").as(Integer.class), id))
.getRestriction();
}
};
return studentDao.findAll(spec, pageable);
}
这里需要有criteria基础
jpa条件查询和分页
最新推荐文章于 2025-03-19 14:40:46 发布