mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-10 04:23:16 +08:00
feat 新特性! 支持列表翻译~
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user