dataease-dm/backend/src/main/java/io/dataease/commons/utils/PageUtils.java
2021-02-20 10:23:37 +08:00

18 lines
514 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package io.dataease.commons.utils;
import com.github.pagehelper.Page;
public class PageUtils {
public static <T> Pager<T> setPageInfo(Page page, T obj) {
try {
Pager<T> pager = new Pager<>();
pager.setListObject(obj);
pager.setPageCount(page.getPages());
pager.setItemCount(page.getTotal());
return pager;
} catch (Exception e) {
throw new RuntimeException("Error saving current page number data");
}
}
}