我有班主任
public class Director {
private Long id;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name="transacao_id")
private Company company;
private Date registrationDate;
...
}
我有一个班级公司
public class Company {
private Long id;
private String cnpj;
private String description;
...
}
我需要在谓词中添加另一个过滤器...
我需要从Director获取列表,使用 jpa 谓词过滤cnpj 列表,例如:
private Predicate[] criarRestricoes(FilterDTO filter, CriteriaBuilder builder, Root<Director> root) {
List<Predicate> predicates = new ArrayList<>();
Date today = new Date();
if (filter.getRegistrationDate() != null) {
predicates.add(builder.between(root.get("registrationDate").as(Date.class), today, filter.dateParam));
}
if (!StringUtils.isEmpty(filter.getCnpj())) {
predicates.add(builder.equal(???????????, ???????????????);
}
return predicates.toArray(new Predicate[predicates.size()]);
}
慕侠2389804
相关分类