Skip to content

Commit

Permalink
修复查询标题下标计算逻辑错误
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyPuppy514 committed Jul 27, 2023
1 parent e3fafc7 commit 3d78d1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/lckp/jproxy/filter/IndexerFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
offset = offset + count;
indexerRequest.setOffset(offset);
indexerRequest.setLimit(indexerRequest.getLimit() - count);
offsetList.set(index, offset);
offsetList.set(index - 1, offset);
indexerService.updateOffsetList(offsetKey, offsetList);
} while (indexerRequest.getLimit() - count > 0);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ public String generateOffsetKey(RequestWrapper requestWrapper) {
*/
@Override
public int calculateCurrentIndex(int offset, List<Integer> offsetList) {
if (offset == 0) {
return 0;
}
for (int index = 0; index < offsetList.size(); index++) {
if (Integer.valueOf(-1).equals(offsetList.get(index))
|| offsetList.get(index).intValue() > offset) {
if (offsetList.get(index).intValue() >= offset) {
return index;
}
}
Expand All @@ -94,7 +96,7 @@ public int calculateCurrentIndex(int offset, List<Integer> offsetList) {
public List<Integer> getOffsetList(String key, int size) {
List<Integer> offsetList = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
offsetList.add(-1);
offsetList.add(0);
}
return offsetList;
}
Expand Down

0 comments on commit 3d78d1a

Please sign in to comment.