fix request
This commit is contained in:
parent
c0c3ce00e5
commit
200a8a0e4a
1 changed files with 9 additions and 7 deletions
|
|
@ -131,6 +131,8 @@ public class DownloadService {
|
|||
String url = response.getSql();
|
||||
String paramName = response.getParamName();
|
||||
Collection<List<String>> pages = partitionList(response.getParams(), limit);
|
||||
url = url.replaceAll(";(?=[^;]*$)", " ") + " LIMIT " + limit + " OFFSET "
|
||||
+ offset + ";";
|
||||
for (List<String> page : pages) {
|
||||
pageIndex++;
|
||||
String resultSet = "(" + page.stream()
|
||||
|
|
@ -139,10 +141,10 @@ public class DownloadService {
|
|||
url = url.replace("${" + paramName + "}",
|
||||
resultSet
|
||||
);
|
||||
url = url.replaceAll(";(?=[^;]*$)", " ") + " LIMIT " + limit + " OFFSET "
|
||||
+ offset + ";";
|
||||
String newUrl = url;
|
||||
int newOffset = offset;
|
||||
while (true) {
|
||||
results = new ArrayList<>(executeSqlQuery(connection, url));
|
||||
results = new ArrayList<>(executeSqlQuery(connection, newUrl));
|
||||
if (results.size() <= 1) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -151,10 +153,10 @@ public class DownloadService {
|
|||
if (results.size() - 1 < limit) {
|
||||
break;
|
||||
}
|
||||
String oldPagination = " OFFSET " + offset + ";";
|
||||
offset += limit;
|
||||
String newPagination = " OFFSET " + offset + ";";
|
||||
url = url.replace(oldPagination, newPagination);
|
||||
String oldPagination = " OFFSET " + newOffset + ";";
|
||||
newOffset += limit;
|
||||
String newPagination = " OFFSET " + newOffset + ";";
|
||||
newUrl = newUrl.replace(oldPagination, newPagination);
|
||||
pageIndex++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue