这是现有的代码,我需要传递订单类型的列表而不是一个orderType。并且这个规范已经添加到现有搜索查询的WHERE
子句中。
如何修改IN
子句的现有规范?
public static Specification<OrderEntity> addReference(String orderType, String refNum) {
return (root, query, builder) -> {
if (null != refType && null != refNum) {
Join<OrderEntity, OrderDetailEntity> orderSearchJoin =
root.join(OrderEntity_.orderDetailEntityList);
query.distinct(true);
return builder.and(
builder.equal(orderSearchJoin.get(OrderDetailEntity_.orderType), orderType),
builder.equal(orderSearchJoin.get(OrderDetailEntity_.referenceNum), refNum));
} else {
return null;
}
};
}
1条答案
按热度按时间oaxa6hgo1#
这可能是您问题的答案:
参考编号:
https://docs.oracle.com/javaee/7/api/javax/persistence/criteria/Join.htmlhttps://docs.oracle.com/javaee/7/api/javax/persistence/criteria/CriteriaBuilder.html显示器