From f29c8786807015d78b9be8a33397f69478d92a76 Mon Sep 17 00:00:00 2001 From: liding <756868258@qq.com> Date: 星期六, 12 七月 2025 16:52:27 +0800 Subject: [PATCH] 1.设备优化 2.配煤计算器 --- main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java | 41 +++++++++++++++++++---------------------- 1 files changed, 19 insertions(+), 22 deletions(-) diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java index 145cf5b..01c3e54 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java +++ b/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java @@ -69,28 +69,25 @@ // 1. 鍒涘缓鏌ヨ鏉′欢锛屾寜鍒涘缓鏃堕棿鍊掑簭鎺掑簭 LambdaQueryWrapper<SalesRecord> queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotBlank(salesRecordDto.getSearchAll())) { - String searchValue = salesRecordDto.getSearchAll(); - // 1. 鍏堝皾璇曚綔涓烘棩鏈熸煡璇� - try { - LocalDate saleDate = LocalDate.parse(searchValue); - queryWrapper.eq(SalesRecord::getSaleDate, saleDate); - } catch (DateTimeParseException e) { - // 2. 濡傛灉涓嶆槸鏃ユ湡锛屽垯浣滀负鐓ょ鍚嶇О鏌ヨ - LambdaQueryWrapper<CoalInfo> coalQueryWrapper = new LambdaQueryWrapper<>(); - coalQueryWrapper.like(CoalInfo::getCoal, searchValue); - List<CoalInfo> coalInfos = coalInfoMapper.selectList(coalQueryWrapper); - if (!coalInfos.isEmpty()) { - // 鎻愬彇鎵�鏈夊尮閰嶇殑鐓ょID - List<Long> coalIds = coalInfos.stream() - .map(CoalInfo::getId) - .collect(Collectors.toList()); - // 浣跨敤in鏌ヨ鍖归厤浠绘剰涓�涓叅绉岻D - queryWrapper.in(SalesRecord::getCoalId, coalIds); - } else { - // 3. 濡傛灉鎵句笉鍒扮叅绉嶏紝鍙互杩斿洖绌虹粨鏋� - queryWrapper.eq(SalesRecord::getCoalId, "-1"); // 浣跨敤涓嶅彲鑳藉瓨鍦ㄧ殑ID - } + // 鎸夋棩鏈熸煡璇� + if (salesRecordDto.getSaleDate() != null) { + queryWrapper.eq(SalesRecord::getSaleDate, salesRecordDto.getSaleDate()); + } + + // 鎸夌叅绉嶅悕绉版煡璇� + if (StringUtils.isNotBlank(salesRecordDto.getCoal())) { + LambdaQueryWrapper<CoalInfo> coalQueryWrapper = new LambdaQueryWrapper<>(); + coalQueryWrapper.like(CoalInfo::getCoal, salesRecordDto.getCoal()); + List<CoalInfo> coalInfos = coalInfoMapper.selectList(coalQueryWrapper); + + if (!coalInfos.isEmpty()) { + List<Long> coalIds = coalInfos.stream() + .map(CoalInfo::getId) + .collect(Collectors.toList()); + queryWrapper.in(SalesRecord::getCoalId, coalIds); + } else { + // 濡傛灉娌℃湁鍖归厤鐨勭叅绉嶏紝鐩存帴杩斿洖绌虹粨鏋� + queryWrapper.eq(SalesRecord::getCoalId, -1L); // 浣跨敤涓嶅彲鑳藉瓨鍦ㄧ殑ID } } -- Gitblit v1.9.3