feat 新特性! 支持列表翻译~

This commit is contained in:
秋辞未寒
2026-03-19 01:42:26 +08:00
parent b67cd76e04
commit d9aa8484ed
13 changed files with 346 additions and 13 deletions

View File

@@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;
/**
* 表格分页数据对象
@@ -27,12 +27,23 @@ public class PageResult<T> implements Serializable {
/**
* 列表数据
*/
private List<T> rows;
private Collection<T> rows;
/**
* 分页
*
* @param list 列表数据
* @param total 总记录数
*/
public PageResult(Collection<T> list, long total) {
this.rows = list;
this.total = total;
}
/**
* 根据分页对象构建表格分页数据对象
*/
public static <T> PageResult<T> build(List<T> list, long total) {
public static <T> PageResult<T> build(Collection<T> list, long total) {
PageResult<T> rspData = new PageResult<>();
rspData.setRows(list);
rspData.setTotal(total);
@@ -42,7 +53,7 @@ public class PageResult<T> implements Serializable {
/**
* 根据数据列表构建表格分页数据对象
*/
public static <T> PageResult<T> build(List<T> list) {
public static <T> PageResult<T> build(Collection<T> list) {
PageResult<T> rspData = new PageResult<>();
rspData.setRows(list);
rspData.setTotal(list.size());

View File

@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
@@ -42,7 +43,7 @@ public class TaskAssigneeDTO implements Serializable {
* 将源列表转换为 TaskHandler 列表
*
* @param <T> 通用类型
* @param sourceList 待转换的源列表
* @param sourceCollection 待转换的源列表
* @param storageId 提取 storageId 的函数
* @param handlerCode 提取 handlerCode 的函数
* @param handlerName 提取 handlerName 的函数
@@ -51,13 +52,13 @@ public class TaskAssigneeDTO implements Serializable {
* @return 转换后的 TaskHandler 列表
*/
public static <T> List<TaskHandler> convertToHandlerList(
List<T> sourceList,
Collection<T> sourceCollection,
Function<T, String> storageId,
Function<T, String> handlerCode,
Function<T, String> handlerName,
Function<T, String> groupName,
Function<T, Date> createTimeMapper) {
return sourceList.stream()
return sourceCollection.stream()
.map(item -> new TaskHandler(
storageId.apply(item),
handlerCode.apply(item),