package com.bcxin.auth.common.core.page;

import com.bcxin.auth.common.constant.Constants;
import com.bcxin.auth.common.utils.ServletUtils;

/**
 * 表格数据处理
 * 
 * @author bcxin
 */
public class TableSupport
{
    /**
     * 封装分页对象
     */
    public static PageDomain getPageDomain()
    {
        PageDomain pageDomain = new PageDomain();
        pageDomain.setPageNum(ServletUtils.getParameterToInt(Constants.PAGE_NUM));
        pageDomain.setPageSize(ServletUtils.getParameterToInt(Constants.PAGE_SIZE));
        pageDomain.setOrderByColumn(ServletUtils.getParameter(Constants.ORDER_BY_COLUMN));
        pageDomain.setIsAsc(ServletUtils.getParameter(Constants.IS_ASC));
        pageDomain.setOrderUnderScore(ServletUtils.getParameterToBool(Constants.ORDER_UNDER_SCORE));
        return pageDomain;
    }

    public static PageDomain buildPageRequest()
    {
        return getPageDomain();
    }
}
