From 4654c9ffbd14edde9346b9ec99a42eedc0fd4d9c Mon Sep 17 00:00:00 2001 From: Yangk Date: Tue, 24 Mar 2026 17:35:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor(oa/erp):=20=E9=87=8D=E6=9E=84=E5=90=88?= =?UTF-8?q?=E5=90=8C=E5=8F=B0=E8=B4=A6=E6=8A=A5=E8=A1=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/ContractLedgerReportMapper.java | 5 +- .../impl/ContractLedgerReportServiceImpl.java | 37 +++++++++- .../oa/erp/ContractLedgerReportMapper.xml | 71 ++++++------------- 3 files changed, 61 insertions(+), 52 deletions(-) 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 ce44b3d5..81fb96b5 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,6 +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.core.toolkit.Constants; +import org.dromara.oa.erp.domain.ErpContractInfo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; import java.util.List; @@ -13,6 +16,6 @@ public interface ContractLedgerReportMapper { /** * 查询合同台账报表列表 */ - List selectContractLedgerList(@Param("bo") ContractLedgerReportVo bo); + List selectContractLedgerList(@Param(Constants.WRAPPER) Wrapper wrapper); } 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 498523b9..08c72c15 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 @@ -1,14 +1,19 @@ package org.dromara.oa.erp.service.impl; import lombok.RequiredArgsConstructor; +import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.oa.erp.domain.ErpContractInfo; import org.dromara.oa.erp.domain.vo.ContractLedgerReportVo; import org.dromara.oa.erp.mapper.ContractLedgerReportMapper; import org.dromara.oa.erp.service.IContractLedgerReportService; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; /** * 合同台账报表Service业务层处理 @@ -19,14 +24,42 @@ public class ContractLedgerReportServiceImpl implements IContractLedgerReportSer private final ContractLedgerReportMapper reportMapper; + private MPJLambdaWrapper buildQueryWrapper(ContractLedgerReportVo bo) { + MPJLambdaWrapper lqw = JoinWrappers.lambda(ErpContractInfo.class); + lqw.eq(ErpContractInfo::getDelFlag, "0"); + + if (bo.getContractIdList() != null && !bo.getContractIdList().isEmpty()) { + lqw.in(ErpContractInfo::getContractId, bo.getContractIdList()); + } + lqw.like(StringUtils.isNotBlank(bo.getCustomerContractCode()), ErpContractInfo::getCustomerContractCode, bo.getCustomerContractCode()); + lqw.like(StringUtils.isNotBlank(bo.getInternalContractCode()), ErpContractInfo::getInternalContractCode, bo.getInternalContractCode()); + lqw.like(StringUtils.isNotBlank(bo.getProjectCode()), "p.project_code", bo.getProjectCode()); + lqw.eq(StringUtils.isNotBlank(bo.getBusinessDirection()), ErpContractInfo::getBusinessDirection, bo.getBusinessDirection()); + + Map params = bo.getParams(); + if (params != null) { + if (params.get("beginContractDate") != null && StringUtils.isNotBlank(params.get("beginContractDate").toString())) { + lqw.apply("DATE_FORMAT(t.contract_date,'%y%m%d') >= DATE_FORMAT({0},'%y%m%d')", params.get("beginContractDate").toString()); + } + if (params.get("endContractDate") != null && StringUtils.isNotBlank(params.get("endContractDate").toString())) { + lqw.apply("DATE_FORMAT(t.contract_date,'%y%m%d') <= DATE_FORMAT({0},'%y%m%d')", params.get("endContractDate").toString()); + } + } + + lqw.orderByDesc(ErpContractInfo::getCreateTime); + return lqw; + } + @Override public TableDataInfo queryContractLedgerList(ContractLedgerReportVo bo) { - List list = reportMapper.selectContractLedgerList(bo); + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + List list = reportMapper.selectContractLedgerList(lqw); return TableDataInfo.build(list); } @Override public List queryContractLedgerAll(ContractLedgerReportVo bo) { - return reportMapper.selectContractLedgerList(bo); + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return reportMapper.selectContractLedgerList(lqw); } } diff --git a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ContractLedgerReportMapper.xml b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ContractLedgerReportMapper.xml index b14febee..9904eb86 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ContractLedgerReportMapper.xml +++ b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ContractLedgerReportMapper.xml @@ -6,25 +6,25 @@