示例#1
0
  public void visit(SetOperationList setOperationList) throws Exception {
    if (setOperationList.getSelects() != null) {
      for (SelectBody selectBody : setOperationList.getSelects()) {
        selectBody.accept(this);
      }
    }

    if (setOperationList.getOrderByElements() != null) {
      for (OrderByElement orderByElement : setOperationList.getOrderByElements()) {
        orderByElement.accept(this);
      }
    }
  }
 /**
  * extra order by and set default orderby to null
  *
  * @param selectBody
  */
 public static List<OrderByElement> extraOrderBy(SelectBody selectBody) {
   if (selectBody instanceof PlainSelect) {
     List<OrderByElement> orderByElements = ((PlainSelect) selectBody).getOrderByElements();
     ((PlainSelect) selectBody).setOrderByElements(null);
     return orderByElements;
   } else if (selectBody instanceof WithItem) {
     WithItem withItem = (WithItem) selectBody;
     if (withItem.getSelectBody() != null) {
       return extraOrderBy(withItem.getSelectBody());
     }
   } else {
     SetOperationList operationList = (SetOperationList) selectBody;
     if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
       List<SelectBody> plainSelects = operationList.getSelects();
       return extraOrderBy(plainSelects.get(plainSelects.size() - 1));
     }
   }
   return null;
 }
示例#3
0
 @Override
 public void visit(SetOperationList setOpList) {
   for (SelectBody select : setOpList.getSelects()) {
     select.accept(this);
   }
 }