fix: 修复并完善ReactorUtils.limit()方法 (#436)

This commit is contained in:
ningqingsheng 2023-11-03 11:31:16 +08:00 committed by GitHub
parent efad62a75b
commit b078d88f82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -36,10 +36,10 @@ import java.util.function.Function;
public class ReactorUtils {
public static <T> Function<Flux<T>, Flux<T>> limit(Long pageIndex, Long pageSize) {
if (pageIndex == null || pageSize == null) {
if (pageIndex == null || pageSize == null || pageIndex < 0 || pageSize <= 0) {
return Function.identity();
}
return flux -> flux.skip(pageIndex & pageSize).take(pageSize);
return flux -> flux.skip(pageIndex * pageSize).take(pageSize);
}
/**
@ -222,4 +222,4 @@ public class ReactorUtils {
}
}
}
}