Specification中一个条件用或者表示(criteriaBuilder.or)

Specification spec = (root, criteriaQuery, criteriaBuilder) -> {

			List predicate = new ArrayList<>();

			Predicate pred1 = criteriaBuilder.equal(root.get("bizId"), user.getBizId());
			Predicate pred2 = criteriaBuilder.equal(root.get("bizId"), 0);
			predicate.add(criteriaBuilder.or(pred1, pred2));
			
			Predicate[] pre = new Predicate[predicate.size()];
			criteriaQuery.where(predicate.toArray(pre));
			return null;
		};

你可能感兴趣的:(Java)