bug fixed for PagerUtils, for issue #3081

This commit is contained in:
shaojin.wensj
2019-02-22 21:19:44 +08:00
parent c732a3569a
commit 24a83cddd1
2 changed files with 28 additions and 2 deletions
@@ -272,8 +272,13 @@ public class PagerUtils {
SQLAggregateExpr aggregateExpr = new SQLAggregateExpr("ROW_NUMBER");
SQLOrderBy orderBy = select.getOrderBy();
aggregateExpr.setOver(new SQLOver(orderBy));
select.setOrderBy(null);
if (orderBy != null) {
aggregateExpr.setOver(new SQLOver(orderBy));
select.setOrderBy(null);
} else if (queryBlock.getOrderBy() != null){
aggregateExpr.setOver(new SQLOver(queryBlock.getOrderBy()));
queryBlock.setOrderBy(null);
}
queryBlock.getSelectList().add(new SQLSelectItem(aggregateExpr, "ROWNUM"));