package com.cloudroam.common.util; import com.cloudroam.vo.PageResponseVO; import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; /** * @author * 分页工具类 */ public class PageUtil { private PageUtil() { throw new IllegalStateException("Utility class"); } public static PageResponseVO build(IPage iPage) { return new PageResponseVO<>(Math.toIntExact(iPage.getTotal()), iPage.getRecords(), Math.toIntExact(iPage.getCurrent()), Math.toIntExact(iPage.getSize())); } public static PageResponseVO build(IPage iPage, List records) { return new PageResponseVO<>(Math.toIntExact(iPage.getTotal()), records, Math.toIntExact(iPage.getCurrent()), Math.toIntExact(iPage.getSize())); } }