Commit c8ec8e8d authored by zhangyong's avatar zhangyong

1

parent dcce7921
...@@ -22,7 +22,11 @@ public class MySqlDialect extends AbstractDialect { ...@@ -22,7 +22,11 @@ public class MySqlDialect extends AbstractDialect {
public String limit(String sql, Page page) { public String limit(String sql, Page page) {
long start = (page.getIndex() - 1) * page.getLimit(); long start = (page.getIndex() - 1) * page.getLimit();
long limit = page.getLimit(); long limit = page.getLimit();
return "select as_limit.* from (" + sql + ") as_limit limit " + start + ", " + limit; String[] orderBy = page.getLimitKey();
String str = StringUtil.join(", ", " order by ", "", orderBy);
return "select as_limit.* from (" + sql + str + ") as_limit limit " + start + ", " + limit;
} }
public String count(String sql) { public String count(String sql) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment