/**
* 条件-模糊-分页查询
* @param page
* @param rows
* @Auther: Mollen
* @return
*/
@Override
public Page<Employee> pageQuery(int page, int rows,Employee employee) {
//创建查询条件
ExampleMatcher matcher = ExampleMatcher.matching()
.withMatcher("employeeNum" ,ExampleMatcher.GenericPropertyMatchers.contains())
.withMatcher("employeName" ,ExampleMatcher.GenericPropertyMatchers.contains())
.withMatcher("dept" ,ExampleMatcher.GenericPropertyMatchers.contains())
.withMatcher("position" ,ExampleMatcher.GenericPropertyMatchers.contains());
//分页
PageRequest pageResult = PageRequest.of(page-1, rows);
return courierDao.findAll(Example.of(courier,matcher),pageResult);
}
JAVA编程132——springdata JPA使用Example快速实现动态查询
最新推荐文章于 2024-11-03 15:52:11 发布