コード例 #1
0
  /**
   * 查看page在订单里面的订单里面所有未付款的订单的中间表的集合(0,1) dlm
   *
   * @param pageid
   * @return
   */
  public List<OrderProductData> getOrdersByPage(String pageid) {

    String ordproHql = " from OrderProductData op where op.pageId=? "; // 先查询中间表
    List<OrderProductData> oplist1 = new ArrayList<OrderProductData>();
    List<OrderProductData> oplist =
        orderProductPersistence.search(ordproHql, new Object[] {pageid});
    if (oplist != null && oplist.size() > 0) {
      for (OrderProductData data : oplist) { // 根据中间表查询订单表
        String orderHql = " from OrderData o WHERE o.id=? and o.state in(0,1) ";
        List<OrderData> olist = orderPersistence.search(orderHql, new Object[] {data.getOrderId()});
        if (olist != null && olist.size() > 0) {
          oplist1.add(data);
        }
      }
    }
    return oplist1;
  }
コード例 #2
0
 @Override
 public List<OrderData> getOrderData(OrderData orderData) {
   // 订单集合
   List<OrderData> orderDatas = new ArrayList<OrderData>();
   // 定义hql查询语句
   StringBuffer hql = new StringBuffer("from OrderData od where 1=1");
   // 定义参数集合
   List<Object> objects = new ArrayList<Object>();
   if (orderData != null
       && orderData.getSysUserId() != null
       && !"".equals(orderData.getSysUserId())) {
     hql.append(" and od.sysUserId = ?");
     objects.add(orderData.getSysUserId());
   }
   if (orderData != null && !"".equals(orderData.getId()) && null != orderData.getId()) {
     hql.append(" and od.id = ?");
     objects.add(orderData.getId());
   }
   orderDatas = orderPersistence.search(hql.toString(), objects);
   return orderDatas;
 }