package com.xhpc.common.core.web.service;

import com.github.pagehelper.PageHelper;
import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.sql.SqlUtil;
import com.xhpc.common.core.web.page.PageDomain;
import com.xhpc.common.core.web.page.TableSupport;

/**
 * @author yuyang
 * @date 2022/1/12 10:54
 */
public class BaseService {

    protected void startPage()
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
        {
            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
            PageHelper.startPage(pageNum, pageSize, orderBy);
        }
    }

}
