refactor(common): 将 Page 实体的 items 类型从 Stream 改为 List
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.lanyuanxiaoyao.service.template.common.entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页数据封装类
|
||||
@@ -27,5 +27,5 @@ import java.util.stream.Stream;
|
||||
* @param items 数据流,包含当前页的所有记录
|
||||
* @param total 总记录数,用于计算总页数和显示分页信息
|
||||
*/
|
||||
public record Page<ENTITY>(Stream<ENTITY> items, long total) {
|
||||
public record Page<ENTITY>(List<ENTITY> items, long total) {
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ public abstract class SimpleControllerSupport<ENTITY extends SimpleEntity, SAVE_
|
||||
var result = service.list(query);
|
||||
return GlobalResponse.responseListData(
|
||||
result.items()
|
||||
.stream()
|
||||
.map(entity -> {
|
||||
try {
|
||||
return mapper.apply(entity);
|
||||
|
||||
@@ -201,7 +201,7 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
||||
},
|
||||
pageRequest
|
||||
);
|
||||
return new Page<>(result.get(), result.getTotalElements());
|
||||
return new Page<>(result.get().toList(), result.getTotalElements());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user