From b0320d5bdec57de1800286cb182a454e4aaccdda Mon Sep 17 00:00:00 2001 From: Yangk Date: Wed, 25 Mar 2026 13:44:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(oa/erp):=20=E4=BF=AE=E5=A4=8D=E5=90=88?= =?UTF-8?q?=E5=90=8C=E5=8F=B0=E8=B4=A6=E6=8A=A5=E8=A1=A8=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在Controller层添加PageQuery参数支持分页查询 - 更新Mapper接口使用MPJLambdaWrapper和Page分页对象 - 修改Service实现类添加分页逻辑和序号计算 - 在VO对象中新增index字段用于显示序号 - 实现分页数据的序号自动编号功能 --- .../ContractLedgerReportController.java | 5 +++-- .../erp/domain/vo/ContractLedgerReportVo.java | 3 +++ .../erp/mapper/ContractLedgerReportMapper.java | 10 ++++++++-- .../service/IContractLedgerReportService.java | 3 ++- .../impl/ContractLedgerReportServiceImpl.java | 18 ++++++++++++++---- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ContractLedgerReportController.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ContractLedgerReportController.java index 866e008f..7921990e 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ContractLedgerReportController.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/controller/ContractLedgerReportController.java @@ -6,6 +6,7 @@ import org.dromara.common.excel.utils.ExcelUtil; import org.dromara.common.log.annotation.Log; import org.dromara.common.log.enums.BusinessType; import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.web.core.BaseController; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; import org.dromara.oa.erp.service.IContractLedgerReportService; @@ -33,8 +34,8 @@ public class ContractLedgerReportController extends BaseController { */ // @SaCheckPermission("oa:erp:contractLedgerReport:list") @GetMapping("/list") - public TableDataInfo list(ContractLedgerReportVo bo) { - return reportService.queryContractLedgerList(bo); + public TableDataInfo list(ContractLedgerReportVo bo, PageQuery pageQuery) { + return reportService.queryContractLedgerList(bo, pageQuery); } /** diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ContractLedgerReportVo.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ContractLedgerReportVo.java index dc88da07..e2fde3b2 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ContractLedgerReportVo.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ContractLedgerReportVo.java @@ -25,6 +25,9 @@ public class ContractLedgerReportVo implements Serializable { private List contractIdList; + @ExcelProperty({"序号", "序号"}) + private Integer index; + @ExcelProperty({"月份", "月份"}) private String month; diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ContractLedgerReportMapper.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ContractLedgerReportMapper.java index 81fb96b5..e02aba98 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ContractLedgerReportMapper.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/mapper/ContractLedgerReportMapper.java @@ -1,8 +1,9 @@ package org.dromara.oa.erp.mapper; import org.apache.ibatis.annotations.Param; -import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.dromara.oa.erp.domain.ErpContractInfo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; @@ -13,9 +14,14 @@ import java.util.List; */ public interface ContractLedgerReportMapper { + /** + * 查询合同台账报表分页列表 + */ + Page selectContractLedgerList(@Param("page") Page page, @Param(Constants.WRAPPER) MPJLambdaWrapper wrapper); + /** * 查询合同台账报表列表 */ - List selectContractLedgerList(@Param(Constants.WRAPPER) Wrapper wrapper); + List selectContractLedgerList(@Param(Constants.WRAPPER) MPJLambdaWrapper wrapper); } diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IContractLedgerReportService.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IContractLedgerReportService.java index 847fbfae..a08357de 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IContractLedgerReportService.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/IContractLedgerReportService.java @@ -1,5 +1,6 @@ package org.dromara.oa.erp.service; +import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; @@ -13,7 +14,7 @@ public interface IContractLedgerReportService { /** * 查询合同台账分页列表 */ - TableDataInfo queryContractLedgerList(ContractLedgerReportVo bo); + TableDataInfo queryContractLedgerList(ContractLedgerReportVo bo, PageQuery pageQuery); /** * 查询合同台账全部列表(供导出使用) diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ContractLedgerReportServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ContractLedgerReportServiceImpl.java index 08c72c15..48b0aa9c 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ContractLedgerReportServiceImpl.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ContractLedgerReportServiceImpl.java @@ -15,6 +15,8 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + /** * 合同台账报表Service业务层处理 */ @@ -51,15 +53,23 @@ public class ContractLedgerReportServiceImpl implements IContractLedgerReportSer } @Override - public TableDataInfo queryContractLedgerList(ContractLedgerReportVo bo) { + public TableDataInfo queryContractLedgerList(ContractLedgerReportVo bo, PageQuery pageQuery) { MPJLambdaWrapper lqw = buildQueryWrapper(bo); - List list = reportMapper.selectContractLedgerList(lqw); - return TableDataInfo.build(list); + Page result = reportMapper.selectContractLedgerList(pageQuery.build(), lqw); + List list = result.getRecords(); + for (int i = 0; i < list.size(); i++) { + list.get(i).setIndex((int) ((pageQuery.getPageNum() - 1) * pageQuery.getPageSize() + i + 1)); + } + return TableDataInfo.build(result); } @Override public List queryContractLedgerAll(ContractLedgerReportVo bo) { MPJLambdaWrapper lqw = buildQueryWrapper(bo); - return reportMapper.selectContractLedgerList(lqw); + List list = reportMapper.selectContractLedgerList(lqw); + for (int i = 0; i < list.size(); i++) { + list.get(i).setIndex(i + 1); + } + return list; } }