mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-30 03:03:13 +08:00
Complete team user code
This commit is contained in:
@ -272,6 +272,25 @@ public class PageResult<T> implements Serializable, Result<List<T>> {
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将当前的类型转换成另外一个类型
|
||||
*
|
||||
* @param mapper 转换的方法
|
||||
* @param <R> 返回的类型
|
||||
* @return 分页返回对象
|
||||
*/
|
||||
public <R> ListResult<R> mapToList(Function<T, R> mapper) {
|
||||
List<R> returnData = hasData(this) ? getData().stream().map(mapper).collect(Collectors.toList())
|
||||
: Collections.emptyList();
|
||||
ListResult<R> result = new ListResult<>();
|
||||
result.setSuccess(getSuccess());
|
||||
result.setErrorCode(getErrorCode());
|
||||
result.setErrorMessage(getErrorMessage());
|
||||
result.setTraceId(getTraceId());
|
||||
result.setData(returnData);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将当前的类型转换成另外一个类型
|
||||
* 并且转换成web的类型
|
||||
|
Reference in New Issue
Block a user