mirror of https://gitee.com/stylefeng/roses
【7.1.5】更新分页参数的获取从baseRequest中获取
parent
f3f5cfba0b
commit
3adbb46014
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue