All Downloads are FREE. Search and download functionalities are using the official Maven repository.

top.jfunc.common.db.utils.PageConvertor Maven / Gradle / Ivy

The newest version!
package top.jfunc.common.db.utils;

import top.jfunc.common.db.bean.Page;

import java.util.List;

/**
 * @author xiongshiyan at 2018/4/28
 * org.springframework.data.domain.Page(数据查询)转换为JFinal的Page(前端展示)
 */
public class PageConvertor {
    /**
     * 将domain的Page转换为页面的Page
     */
    public static  Page convert(org.springframework.data.domain.Page domainPage){
        int totalPages = domainPage.getTotalPages();
        int totalRows = (int)domainPage.getTotalElements();
        List content = domainPage.getContent();
        int pageNumber = domainPage.getNumber() + 1;
        int pageSize = domainPage.getSize();
        return new Page<>(content , pageNumber , pageSize , totalPages , totalRows);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy