【7.1.5】更新分页参数的获取从baseRequest中获取

pull/22/head
fengshuonan 2021-10-19 16:06:29 +08:00
parent f3f5cfba0b
commit 3adbb46014
1 changed files with 19 additions and 1 deletions

View File

@ -25,8 +25,9 @@
package cn.stylefeng.roses.kernel.db.api.factory;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.servlet.http.HttpServletRequest;
@ -76,4 +77,21 @@ public class PageFactory {
return new Page<>(pageNo, pageSize);
}
/**
* baseRequest
*
* @author fengshuonan
* @date 2021/10/19 16:05
*/
public static <T> Page<T> defaultPage(BaseRequest baseRequest) {
int pageSize = 20;
int pageNo = 1;
if (ObjectUtil.isNotEmpty(baseRequest)) {
pageNo = baseRequest.getPageNo() == null ? pageNo : baseRequest.getPageNo();
pageSize = baseRequest.getPageSize() == null ? pageNo : baseRequest.getPageSize();
}
return new Page<>(pageNo, pageSize);
}
}