123
This commit is contained in:
29
ruoyi-cai/src/main/java/com/ruoyi/cai/util/IPageUtil.java
Normal file
29
ruoyi-cai/src/main/java/com/ruoyi/cai/util/IPageUtil.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.cai.util;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class IPageUtil {
|
||||
public static <T,V> IPage<V> transIPage(IPage<T> page, List<V> records){
|
||||
IPage<V> res = new Page<>();
|
||||
res.setPages(page.getPages());
|
||||
res.setRecords(records);
|
||||
res.setTotal(page.getTotal());
|
||||
res.setSize(page.getSize());
|
||||
res.setCurrent(page.getCurrent());
|
||||
return res;
|
||||
}
|
||||
|
||||
public static <T,V> IPage<V> transIPageEmpty(IPage<T> page){
|
||||
IPage<V> res = new Page<>();
|
||||
res.setPages(page.getPages());
|
||||
res.setRecords(Collections.emptyList());
|
||||
res.setTotal(page.getTotal());
|
||||
res.setSize(page.getSize());
|
||||
res.setCurrent(page.getCurrent());
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user