From d338b50afd6504a9676f0a26b3ecbcc844483e7c Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 21 十一月 2024 08:57:08 +0800
Subject: [PATCH] 并发采集

---
 iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java b/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java
index 0924bf0..ccf2c77 100644
--- a/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java
+++ b/iailab-framework/iailab-common-mybatis/src/main/java/com/iailab/framework/mybatis/core/mapper/BaseMapperX.java
@@ -1,6 +1,7 @@
 package com.iailab.framework.mybatis.core.mapper;
 
 import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.iailab.framework.common.pojo.PageParam;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.pojo.SortablePageParam;
@@ -32,6 +33,26 @@
  */
 public interface BaseMapperX<T> extends MPJBaseMapper<T> {
 
+    /**
+     * 获取分页对象
+     * @param params      分页查询参数
+     */
+    default IPage<T> getPage(PageParam params) {
+        //分页参数
+        long curPage = 1;
+        long limit = 10;
+
+        if(params.getPageNo() != null){
+            curPage = params.getPageNo();
+        }
+        if(params.getPageSize() != null){
+            limit = params.getPageSize();
+        }
+
+        //分页对象
+        return new Page<>(curPage, limit);
+    }
+
     default PageResult<T> selectPage(SortablePageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
         return selectPage(pageParam, pageParam.getSortingFields(), queryWrapper);
     }
@@ -56,7 +77,7 @@
 
     default <D> PageResult<D> selectJoinPage(PageParam pageParam, Class<D> clazz, MPJLambdaWrapper<T> lambdaWrapper) {
         // 特殊:不分页,直接查询全部
-        if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageNo())) {
+        if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageSize())) {
             List<D> list = selectJoinList(clazz, lambdaWrapper);
             return new PageResult<>(list, (long) list.size());
         }

--
Gitblit v1.9.3