Search in sources :

Example 11 with Page

use of com.github.pagehelper.Page in project Java by Everything1sPossible.

the class PageBeanUtil method toPageResult.

@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> PageResult<T> toPageResult(List<T> datas) {
    if (result == null) {
        result = new PageResult<T>();
    }
    if (datas instanceof Page) {
        Page page = (Page) datas;
        result.setDataList(page.getResult());
        result.setPageNo(page.getPageNum());
        result.setPageSize(page.getPageSize());
        result.setPages(page.getPages());
        result.setTotal(page.getTotal());
    } else {
        result.setPageNo(1);
        result.setPageSize(datas.size());
        result.setDataList(datas);
        result.setTotal(datas.size());
    }
    return result;
}
Also used : Page(com.github.pagehelper.Page)

Aggregations

Page (com.github.pagehelper.Page)11 IPage (com.github.pagehelper.IPage)2 PageRowBounds (com.github.pagehelper.PageRowBounds)2 MetaObject (org.apache.ibatis.reflection.MetaObject)2 PageException (com.github.pagehelper.PageException)1 ProviderSqlSource (org.apache.ibatis.builder.annotation.ProviderSqlSource)1 ParameterMapping (org.apache.ibatis.mapping.ParameterMapping)1 OpenPage (org.tech.commons.OpenPage)1 People (org.tech.domain.People)1