写下以下标准
Date vardate = 'Tue Jan 01 00:00:00 IST 2100';
public Predicate toPredicate(
Root<T> root,
CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicates = new ArrayList<Predicate>();
predicates.add(cb.equal(root.get(LINE_OF_BUSINESS_ID), lobId));
//Predicate a = cb.and(cb.isNotNull(stateSuretyRates.<Date>get(EXP_DATE)),
cb.greaterThanOrEqualTo(stateSuretyRates.<Date>get(EXP_DATE),effDate));
return cb.and(predicates.toArray(new Predicate[] {}));
}
和查询
select ... from table t Where t.business = 1 and
(
(t.StartA <= 'some EndB') and (t.EndA >= 'some StartB') and (t.EndA is not null) and ('some EndB' is not null)
OR
(t.StartA <= 'some EndB') and (vardate >= 'some StartB') and (t.EndA is null) and ('some EndB' is not null)
OR
(t.StartA <= vardate) and (t.EndA >= 'some StartB') and (t.EndA is not null) and ('some EndB' is null)
OR
(t.StartA <= vardate) and (vardate >= 'some StartB') and (t.EndA is null) and ('some EndB' is null)
)
请建议如何编写谓词和谓词