forked from github/dataease
fix: DB2 分页
This commit is contained in:
parent
561bf05883
commit
43ffde295d
@ -810,11 +810,11 @@ public class Db2QueryProvider extends QueryProvider {
|
|||||||
|
|
||||||
|
|
||||||
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
|
public String getTotalCount(boolean isTable, String sql, Datasource ds) {
|
||||||
if(isTable){
|
if (isTable) {
|
||||||
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
|
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
|
||||||
schema = String.format(Db2Constants.KEYWORD_TABLE, schema);
|
schema = String.format(Db2Constants.KEYWORD_TABLE, schema);
|
||||||
return "SELECT COUNT(*) from " + schema + "." + String.format(Db2Constants.KEYWORD_TABLE, sql);
|
return "SELECT COUNT(*) from " + schema + "." + String.format(Db2Constants.KEYWORD_TABLE, sql);
|
||||||
}else {
|
} else {
|
||||||
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
|
return "SELECT COUNT(*) from ( " + sql + " ) DE_COUNT_TEMP";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -828,7 +828,7 @@ public class Db2QueryProvider extends QueryProvider {
|
|||||||
}).toArray(String[]::new);
|
}).toArray(String[]::new);
|
||||||
if (ds != null) {
|
if (ds != null) {
|
||||||
Db2Configuration db2Configuration = new Gson().fromJson(ds.getConfiguration(), Db2Configuration.class);
|
Db2Configuration db2Configuration = new Gson().fromJson(ds.getConfiguration(), Db2Configuration.class);
|
||||||
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), db2Configuration.getSchema() + String.format(Db2Constants.KEYWORD_TABLE, table));
|
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), String.format(Db2Constants.KEYWORD_TABLE, db2Configuration.getSchema()) + "." + String.format(Db2Constants.KEYWORD_TABLE, table));
|
||||||
} else {
|
} else {
|
||||||
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table);
|
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_OFFSET, DE_PAGE_SIZE ", StringUtils.join(array, ","), table);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user