refactor(admin): 更新字典数据DTO和VO的注解以及分页处理逻辑
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
lsym004933
2026-01-17 14:41:32 +08:00
parent c3b925cc13
commit 183b8ddc01
6 changed files with 46 additions and 39 deletions

View File

@@ -3,6 +3,7 @@ package cn.fateverse.common.mybatisplus.utils;
import cn.fateverse.common.core.entity.PageInfo;
import cn.fateverse.common.core.result.page.TableDataInfo;
import cn.fateverse.common.core.utils.TableSupport;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
@@ -26,12 +27,22 @@ public class PageUtils {
* @param <R> 需要转换的对象类型
* @return 转换后的对象
*/
public static <T, R> TableDataInfo<T> convertDataTable(Page<R> page, Function<R, T> map) {
public static <T, R> TableDataInfo<T> convertDataTable(IPage<R> page, Function<R, T> map) {
List<T> convertList = page.getRecords().stream().map(map).collect(Collectors.toList());
return convertDataTable(convertList, page.getTotal());
}
public static <T> TableDataInfo<T> convertDataTable(IPage<T> page) {
return convertDataTable(page.getRecords(), page.getTotal());
}
public static <T> TableDataInfo<T> emptyTable() {
return convertDataTable(new ArrayList<>(), 0L);
}
/**
* 转换为TableDataInfo对象
*
@@ -50,7 +61,7 @@ public class PageUtils {
return tableDataInfo;
}
public static <T> Page<T> getPage(){
public static <T> Page<T> getPage() {
PageInfo pageInfo = TableSupport.getPageInfo();
return new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
}