From c97cdbe5d491e2ec235178d5e7f65bcd0ccc5f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 14 Aug 2023 21:01:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=20mp=20=E7=89=88=E6=9C=AC=E5=AF=BC=E8=87=B4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/mybatis/core/mapper/BaseMapperPlus.java | 8 ++++---- .../main/java/org/dromara/demo/mapper/TestDemoMapper.java | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java index 1f36f040..b2b74a0f 100644 --- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java +++ b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/core/mapper/BaseMapperPlus.java @@ -182,12 +182,12 @@ public interface BaseMapperPlus extends BaseMapper { * 分页查询VO */ default > P selectVoPage(IPage page, Wrapper wrapper, Class voClass) { - IPage pageData = this.selectPage(page, wrapper); - IPage voPage = new Page<>(pageData.getCurrent(), pageData.getSize(), pageData.getTotal()); - if (CollUtil.isEmpty(pageData.getRecords())) { + List list = this.selectList(page, wrapper); + IPage voPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal()); + if (CollUtil.isEmpty(list)) { return (P) voPage; } - voPage.setRecords(MapstructUtils.convert(pageData.getRecords(), voClass)); + voPage.setRecords(MapstructUtils.convert(list, voClass)); return (P) voPage; } diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/mapper/TestDemoMapper.java b/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/mapper/TestDemoMapper.java index 044d2b6e..ddf68f20 100644 --- a/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/mapper/TestDemoMapper.java +++ b/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/mapper/TestDemoMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.poi.ss.formula.functions.T; import org.dromara.common.mybatis.annotation.DataColumn; import org.dromara.common.mybatis.annotation.DataPermission; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; @@ -33,7 +34,7 @@ public interface TestDemoMapper extends BaseMapperPlus { @DataColumn(key = "deptName", value = "dept_id"), @DataColumn(key = "userName", value = "user_id") }) -

> P selectPage(P page, @Param(Constants.WRAPPER) Wrapper queryWrapper); + List selectList(IPage page, @Param(Constants.WRAPPER) Wrapper queryWrapper); @Override @DataPermission({