Esempio n. 1
0
 protected void addOrders(
     StringBuilder qlString,
     List<com.hongqiang.shop.common.utils.Order> orderList,
     List<Object> params) {
   if (orderList != null && orderList.size() > 0) {
     if (qlString.indexOf("order by") == -1) {
       qlString.append("order by ");
     } else {
       qlString.append(" , ");
     }
     Iterator<com.hongqiang.shop.common.utils.Order> localIterator = orderList.iterator();
     while (localIterator.hasNext()) {
       com.hongqiang.shop.common.utils.Order localOrder =
           (com.hongqiang.shop.common.utils.Order) localIterator.next();
       if (localOrder.getDirection() == com.hongqiang.shop.common.utils.Order.Direction.asc) {
         qlString.append(localOrder.getProperty() + " ASC,");
       } else {
         if (localOrder.getDirection() != com.hongqiang.shop.common.utils.Order.Direction.desc)
           continue;
         qlString.append(localOrder.getProperty() + " DESC,");
       }
     }
     if (qlString.charAt(qlString.length() - 1) == ',') {
       qlString.deleteCharAt(qlString.length() - 1);
     }
   }
 }
Esempio n. 2
0
 protected void addOrders(StringBuilder qlString, Pageable pageable, List<Object> params) {
   int tag = 0;
   if ((StringUtils.isNotEmpty(pageable.getOrderProperty()))
       && (pageable.getOrderDirection() != null)) {
     tag = 1;
     if (qlString.indexOf("order by") == -1) {
       qlString.append("order by ");
     } else {
       qlString.append(" , ");
     }
     if (pageable.getOrderDirection() == com.hongqiang.shop.common.utils.Order.Direction.asc) {
       qlString.append(" " + pageable.getOrderProperty() + " ASC ");
     } else if (pageable.getOrderDirection()
         == com.hongqiang.shop.common.utils.Order.Direction.desc) {
       qlString.append(" " + pageable.getOrderProperty() + " DESC ");
     }
   }
   if (pageable.getOrders() != null && pageable.getOrders().size() > 0) {
     if (tag == 0) {
       qlString.append("order by ");
     } else {
       qlString.append(" , ");
     }
     Iterator<com.hongqiang.shop.common.utils.Order> localIterator =
         pageable.getOrders().iterator();
     while (localIterator.hasNext()) {
       com.hongqiang.shop.common.utils.Order localOrder =
           (com.hongqiang.shop.common.utils.Order) localIterator.next();
       if (localOrder.getDirection() == com.hongqiang.shop.common.utils.Order.Direction.asc) {
         qlString.append(" " + localOrder.getProperty() + " ASC,");
       } else {
         if (localOrder.getDirection() != com.hongqiang.shop.common.utils.Order.Direction.desc)
           continue;
         qlString.append(" " + localOrder.getProperty() + " DESC,");
       }
     }
     if (qlString.charAt(qlString.length() - 1) == ',') {
       qlString.deleteCharAt(qlString.length() - 1);
     }
   }
 }