From 5fe810b279c4274013bafe83d9a217715eb29eb0 Mon Sep 17 00:00:00 2001 From: zch Date: Thu, 29 May 2025 08:55:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(record):=20=E4=BC=98=E5=8C=96=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=AE=B0=E5=BD=95=E8=A1=A8=E5=90=8D=E7=A7=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将表存在性检查移至循环内,避免生成不必要的表名 - 如果表不存在,则跳过,不添加到结果列表中 - 移除了循环外的冗余表存在性检查 --- .../service/impl/RecordIotenvInstantServiceImpl.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/os-ems/src/main/java/com/os/ems/record/service/impl/RecordIotenvInstantServiceImpl.java b/os-ems/src/main/java/com/os/ems/record/service/impl/RecordIotenvInstantServiceImpl.java index 9e9aaa3..deb0044 100644 --- a/os-ems/src/main/java/com/os/ems/record/service/impl/RecordIotenvInstantServiceImpl.java +++ b/os-ems/src/main/java/com/os/ems/record/service/impl/RecordIotenvInstantServiceImpl.java @@ -152,17 +152,14 @@ public class RecordIotenvInstantServiceImpl implements IRecordIotenvInstantServi while (!currentDate.after(endDateOnly)) { String tableSuffix = tableFormat.format(currentDate); String tableName = "record_iotenv_instant_" + tableSuffix; - tableNames.add(tableName); + if (isTableExists(tableName)){ + tableNames.add(tableName); + } // 日期加1天 calendar.setTime(currentDate); calendar.add(Calendar.DAY_OF_MONTH, 1); currentDate = calendar.getTime(); } - for (String tableName : tableNames){ - if (!isTableExists(tableName)){ - return new ArrayList<>(); - } - } return tableNames; }