From 8f4db901aa772a808c243f8a4e39522f6f09d5da Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期四, 21 八月 2025 13:10:22 +0800
Subject: [PATCH] 修改完善3

---
 src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java
index 80cba1e..c59f3c1 100644
--- a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java
@@ -71,18 +71,23 @@
     @Override
     public IPage<MeasuringInstrumentLedger> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) {
         IPage<MeasuringInstrumentLedger> measuringInstrumentLedgerIPage = measuringInstrumentLedgerMapper.listPage(page, measuringInstrumentLedger);
+        List<Integer>  types = new ArrayList<>();
+        types.add(FileNameType.MEASURING.getValue());
+        types.add(FileNameType.MEASURINGRecord.getValue());
         measuringInstrumentLedgerIPage.getRecords().forEach(item -> {
             LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
             measuringInstrumentLedgerRecordLambdaQueryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId, item.getId());
             List<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecords = measuringInstrumentLedgerRecordMapper.selectList(measuringInstrumentLedgerRecordLambdaQueryWrapper);
+            List<Long> collect = new ArrayList<>();
             if(!CollectionUtils.isEmpty(measuringInstrumentLedgerRecords)){
-                List<Long> collect = measuringInstrumentLedgerRecords.stream().map(MeasuringInstrumentLedgerRecord::getId).collect(Collectors.toList());
-                collect.add(item.getId());
-                LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>();
-                salesLedgerFileWrapper.in(CommonFile::getCommonId, collect);
-                List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper);
-                item.setCommonFiles(commonFiles);
+                collect = measuringInstrumentLedgerRecords.stream().map(MeasuringInstrumentLedgerRecord::getId).collect(Collectors.toList());
             }
+            collect.add(item.getId());
+            LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>();
+            salesLedgerFileWrapper.in(CommonFile::getCommonId, collect)
+                    .in(CommonFile::getType,types);
+            List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper);
+            item.setCommonFiles(commonFiles);
 
         });
         return measuringInstrumentLedgerIPage;

--
Gitblit v1.9.3