feat(可回溯): 可回溯
修改分页查询
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -33,6 +34,7 @@ public class OrderController {
|
||||
@PostMapping("/list")
|
||||
public Mono<ResObj> list(@RequestBody Order order) {
|
||||
OrderList resList = new OrderList();
|
||||
List<Order> list = new ArrayList<>();
|
||||
PageRequest pageRequest = PageRequest.of(order.getPage(), order.getPageSize());
|
||||
ExampleMatcher matcher = ExampleMatcher.matching()
|
||||
.withIgnoreNullValues().withIgnorePaths("createAt", "last");
|
||||
@@ -42,11 +44,16 @@ public class OrderController {
|
||||
|
||||
Flux<Order> flux = orderRepository.findAll(ep, s);
|
||||
flux.count().subscribe(c -> resList.setTotal(c));
|
||||
Mono<List<Order>> listMono = flux.skip(pageRequest.getOffset()).limitRequest(pageRequest.getPageSize()).collectList();
|
||||
return listMono.flatMap(list -> {
|
||||
resList.setList(list);
|
||||
return Mono.just(ResObj.ok(resList));
|
||||
flux.skip(pageRequest.getOffset()).limitRequest(pageRequest.getPageSize()).subscribe(f -> {
|
||||
list.add(f);
|
||||
});
|
||||
resList.setList(list);
|
||||
// Mono<List<Order>> listMono = flux.skip(pageRequest.getOffset()).limitRequest(pageRequest.getPageSize()).collectList();
|
||||
// return listMono.flatMap(list -> {
|
||||
// resList.setList(list);
|
||||
// return Mono.just(ResObj.ok(resList));
|
||||
// });
|
||||
return Mono.just(ResObj.ok(resList));
|
||||
}
|
||||
|
||||
@PostMapping("/info/{orderId}")
|
||||
|
||||
Reference in New Issue
Block a user