package org.matrix.autotest.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.matrix.exception.GlobalException;

/**
 * @author MRY
 */
public class PageTools {

    public static void pageTool(int pageSize, int pageNum, Page<?> results) {
        long total = results.getTotal();
        //页数
        long length = total / pageSize;

        if (total % pageSize != 0) {
            length = length + 1;
        }
        if (pageNum > length) {
            throw new GlobalException("您查询的页码已经超出范围");
        }
    }
}
