Java Code Examples for com.github.pagehelper.Page#setOrderBy()

The following examples show how to use com.github.pagehelper.Page#setOrderBy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PageMethod.java    From Mybatis-PageHelper with MIT License 5 votes vote down vote up
/**
 * 开始分页
 *
 * @param params
 */
public static <E> Page<E> startPage(Object params) {
    Page<E> page = PageObjectUtil.getPageFromObject(params, true);
    //当已经执行过orderBy的时候
    Page<E> oldPage = getLocalPage();
    if (oldPage != null && oldPage.isOrderByOnly()) {
        page.setOrderBy(oldPage.getOrderBy());
    }
    setLocalPage(page);
    return page;
}
 
Example 2
Source File: PageMethod.java    From Mybatis-PageHelper with MIT License 5 votes vote down vote up
/**
 * 开始分页
 *
 * @param pageNum      页码
 * @param pageSize     每页显示数量
 * @param count        是否进行count查询
 * @param reasonable   分页合理化,null时用默认配置
 * @param pageSizeZero true且pageSize=0时返回全部结果,false时分页,null时用默认配置
 */
public static <E> Page<E> startPage(int pageNum, int pageSize, boolean count, Boolean reasonable, Boolean pageSizeZero) {
    Page<E> page = new Page<E>(pageNum, pageSize, count);
    page.setReasonable(reasonable);
    page.setPageSizeZero(pageSizeZero);
    //当已经执行过orderBy的时候
    Page<E> oldPage = getLocalPage();
    if (oldPage != null && oldPage.isOrderByOnly()) {
        page.setOrderBy(oldPage.getOrderBy());
    }
    setLocalPage(page);
    return page;
}
 
Example 3
Source File: PageMethod.java    From Mybatis-PageHelper with MIT License 5 votes vote down vote up
/**
 * 开始分页
 *
 * @param offset 起始位置,偏移位置
 * @param limit  每页显示数量
 * @param count  是否进行count查询
 */
public static <E> Page<E> offsetPage(int offset, int limit, boolean count) {
    Page<E> page = new Page<E>(new int[]{offset, limit}, count);
    //当已经执行过orderBy的时候
    Page<E> oldPage = getLocalPage();
    if (oldPage != null && oldPage.isOrderByOnly()) {
        page.setOrderBy(oldPage.getOrderBy());
    }
    setLocalPage(page);
    return page;
}
 
Example 4
Source File: PageMethod.java    From Mybatis-PageHelper with MIT License 2 votes vote down vote up
/**
 * 开始分页
 *
 * @param pageNum  页码
 * @param pageSize 每页显示数量
 * @param orderBy  排序
 */
public static <E> Page<E> startPage(int pageNum, int pageSize, String orderBy) {
    Page<E> page = startPage(pageNum, pageSize);
    page.setOrderBy(orderBy);
    return page;
}