Jpa复杂查询字段、分页、排序
page = page * pageSize;
startTime = startTime + " 00:00:00";
endTime = endTime+ " 23:59:59";
Date startDate = DateUtil.parse(startTime, "yyyy-MM-dd HH:mm:ss");
Date endDate = DateUtil.parse(endTime, "yyyy-MM-dd HH:mm:ss");
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<类> root = query.from(类.class);
query.multiselect(root.get("字段"),cb.max(root.get("字段")),cb.count(root.get("字段")));
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.get("字段"), 参数));
predicates.add(cb.equal(root.get("字段"), 参数));
if (NonUtil.isNotNon(参数)){
predicates.add(cb.equal(root.get("字段"), 参数));
}
if(NonUtil.isNotNon(tagName)){
predicates.add(root.get("字段").in(参数));
}
//如果有时间条件
if (NonUti