From 1b81528d0dea265cb7c43a7d58722e220efd896e Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 29 Dec 2025 16:27:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor(database):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=82=E6=95=B0=E5=80=BC=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 - 移除 collect_time 字段的查询以提升性能 - 添加 NVL 函数处理空值情况 - 简化查询结果集结构 - 优化数据库查询的执行效率 - 调整字段映射逻辑以符合业务需求 --- .../main/resources/mapper/base/BaseDeviceParamValMapper.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/aucma-base/src/main/resources/mapper/base/BaseDeviceParamValMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseDeviceParamValMapper.xml index 18aab62..01c7487 100644 --- a/aucma-base/src/main/resources/mapper/base/BaseDeviceParamValMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/BaseDeviceParamValMapper.xml @@ -187,7 +187,6 @@ SELECT device_code, param_value, - collect_time, ROW_NUMBER() OVER (PARTITION BY device_code ORDER BY NVL(record_time, collect_time) DESC) AS rn FROM base_device_param_val WHERE TRUNC(collect_time) = TRUNC(SYSDATE) @@ -197,8 +196,7 @@ d.device_code AS deviceCode, d.device_name AS deviceName, d.product_line_code AS productLineCode, - t.param_value AS startTime, - t.collect_time AS collectTime + NVL(t.param_value, '') AS startTime FROM base_deviceledger d LEFT JOIN today_latest t ON d.device_code = t.device_code AND t.rn = 1 WHERE d.is_flag = 1