From 956481188a15a01b6c4372a47e95a6aca3100956 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期一, 16 三月 2026 13:07:20 +0800
Subject: [PATCH] refactor(production): 优化采购入库记录查询逻辑
---
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index 15f2596..57fcc88 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -221,11 +221,15 @@
ProcurementRecordOut procurementRecordOut1 = procurementRecordOutMapper.selectCode(dateFormat.format(now));
Long aLong = procurementRecordOut1 == null ? 1L : Long.valueOf(procurementRecordOut1.getCode().split("LS" + dateFormat.format(now))[1]);
// 鏌ヨ閲囪喘鍏ュ簱璁板綍
- List<ProcurementRecordStorage> procurementRecordStorages = procurementRecordMapper.selectList(new LambdaQueryWrapper<ProcurementRecordStorage>()
- .in(ProcurementRecordStorage::getSalesLedgerProductId, salesLedgerProducts.stream()
- .map(SalesLedgerProduct::getId)
- .collect(Collectors.toList()))
- .orderByDesc(ProcurementRecordStorage::getInboundNum));
+ LambdaQueryWrapper<ProcurementRecordStorage> procurementRecordStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ if (!org.springframework.util.CollectionUtils.isEmpty(salesLedgerProducts)) {
+ procurementRecordStorageLambdaQueryWrapper.in(ProcurementRecordStorage::getSalesLedgerProductId, salesLedgerProducts.stream()
+ .map(SalesLedgerProduct::getId)
+ .collect(Collectors.toList()));
+ }
+
+ procurementRecordStorageLambdaQueryWrapper.orderByDesc(ProcurementRecordStorage::getInboundNum);
+ List<ProcurementRecordStorage> procurementRecordStorages = procurementRecordMapper.selectList(procurementRecordStorageLambdaQueryWrapper);
if(CollectionUtils.isNotEmpty(procurementRecordStorages)) {
// 鐢熶骇鎵i櫎閲囪喘搴撳瓨鍘熸枡
BigDecimal quantity = productionProductInput.getQuantity();
--
Gitblit v1.9.3