mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-02 00:33:24 +08:00
update 优化 代码
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -42,7 +43,7 @@ public class TaskAssigneeDTO implements Serializable {
|
|||||||
* 将源列表转换为 TaskHandler 列表
|
* 将源列表转换为 TaskHandler 列表
|
||||||
*
|
*
|
||||||
* @param <T> 通用类型
|
* @param <T> 通用类型
|
||||||
* @param sourceList 待转换的源列表
|
* @param sourceCollection 待转换的源列表
|
||||||
* @param storageId 提取 storageId 的函数
|
* @param storageId 提取 storageId 的函数
|
||||||
* @param handlerCode 提取 handlerCode 的函数
|
* @param handlerCode 提取 handlerCode 的函数
|
||||||
* @param handlerName 提取 handlerName 的函数
|
* @param handlerName 提取 handlerName 的函数
|
||||||
@@ -51,13 +52,13 @@ public class TaskAssigneeDTO implements Serializable {
|
|||||||
* @return 转换后的 TaskHandler 列表
|
* @return 转换后的 TaskHandler 列表
|
||||||
*/
|
*/
|
||||||
public static <T> List<TaskHandler> convertToHandlerList(
|
public static <T> List<TaskHandler> convertToHandlerList(
|
||||||
List<T> sourceList,
|
Collection<T> sourceCollection,
|
||||||
Function<T, String> storageId,
|
Function<T, String> storageId,
|
||||||
Function<T, String> handlerCode,
|
Function<T, String> handlerCode,
|
||||||
Function<T, String> handlerName,
|
Function<T, String> handlerName,
|
||||||
Function<T, String> groupName,
|
Function<T, String> groupName,
|
||||||
Function<T, Date> createTimeMapper) {
|
Function<T, Date> createTimeMapper) {
|
||||||
return sourceList.stream()
|
return sourceCollection.stream()
|
||||||
.map(item -> new TaskHandler(
|
.map(item -> new TaskHandler(
|
||||||
storageId.apply(item),
|
storageId.apply(item),
|
||||||
handlerCode.apply(item),
|
handlerCode.apply(item),
|
||||||
|
|||||||
Reference in New Issue
Block a user