Skip to content

Commit

Permalink
0004760: Fix batch screen lazy loading bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jan 14, 2021
1 parent 7b9c167 commit ac6b035
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -246,9 +246,9 @@ public String massageForLimitOffset(String sql, int limit, int offset) {
int orderIndex = StringUtils.lastIndexOfIgnoreCase(sql, "order by");
String order = sql.substring(orderIndex);
String innerSql = sql.substring(0, orderIndex - 1);
innerSql = StringUtils.replaceIgnoreCase(innerSql, " from", ", ROW_NUMBER() over (" + order + ") as RowNum from");
return "select from (" + innerSql + ") " +
"where RowNum between " + (offset + 1) + " and " + (offset + limit) + ";";
innerSql = StringUtils.replaceIgnoreCase(innerSql, " from", ", ROW_NUMBER() over (" + order + ") as row_num from");
return "select * from (" + innerSql + ") " +
"where row_num between " + (offset + 1) + " and " + (offset + limit);
}

}

0 comments on commit ac6b035

Please sign in to comment.