public List<Order> getOrdersList(Order order) {
List<Order> list = orderRepository.findAll(new Specification<Order>() {
List<Order> list = orderRepository.findAll(new Specification<Order>() {
@Override
public Predicate toPredicate(Root<Order> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicates = new ArrayList<Predicate>();
if(order!=null) {
if(!"".equals(order.getOid())&&null!=order.getOid()) {
predicates.add(cb.equal(root.get("oid"), order.getOid()));
}
if(!"".equals(order.getPay_type())&&null!=order.getPay_type()) {
predicates.add(cb.equal(root.get("pay_type"), order.getPay_type()));
}
if(!"".equals(order.getStatu())&&null!=order.getStatu()) {
predicates.add(cb.equal(root.get("statu"), order.getStatu()));
}
}
query.where(predicates.toArray(new Predicate[predicates.size()]));
return null;
}
});
return list;
}
public Predicate toPredicate(Root<Order> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicates = new ArrayList<Predicate>();
if(order!=null) {
if(!"".equals(order.getOid())&&null!=order.getOid()) {
predicates.add(cb.equal(root.get("oid"), order.getOid()));
}
if(!"".equals(order.getPay_type())&&null!=order.getPay_type()) {
predicates.add(cb.equal(root.get("pay_type"), order.getPay_type()));
}
if(!"".equals(order.getStatu())&&null!=order.getStatu()) {
predicates.add(cb.equal(root.get("statu"), order.getStatu()));
}
}
query.where(predicates.toArray(new Predicate[predicates.size()]));
return null;
}
});
return list;
}
@Modifying
@Query(value="update Order o set o.pay_type=:pay_type,o.statu=:statu where o.oid=:oid")
void updateOrder(@Param("oid")String oid,@Param("pay_type") String pay_type,@Param("statu") String statu);
@Query(value="update Order o set o.pay_type=:pay_type,o.statu=:statu where o.oid=:oid")
void updateOrder(@Param("oid")String oid,@Param("pay_type") String pay_type,@Param("statu") String statu);