From dc17be9d01b5df54043e65906cb1e4e847b77946 Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 19 Jan 2024 15:08:48 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=8D=B2=E5=8F=96table=E5=90=8D=E7=A8=B1=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/HistoryController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index e332d13..f61b19d 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1318,7 +1318,8 @@ namespace FrontendWebApi.ApiControllers { var device_number = hi.Device_number_point.Split(":")[0]; var point = hi.Device_number_point.Split(":")[1]; - var tableName = await backgroundServiceMsSqlRepository.GetOneAsync($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}_{point}%'"); + var stationName = await backendRepository.GetOneAsync($"select distinct parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split('_')[0]}' limit 1"); + var tableName = await backgroundServiceMsSqlRepository.GetOneAsync($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{stationName}_{device_number}_{point}%'"); if (!string.IsNullOrEmpty(tableName)) { var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = device_number }); @@ -1329,7 +1330,7 @@ namespace FrontendWebApi.ApiControllers '{device_item_info.Sub_system_name}' as Sub_system_name, '{device_item_info.Device_number}' as Device_number, '{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points, '{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value - from FIC_CENTER_{device_number}_{point} + from {tableName} where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime order by timestamp"; apiResult.Data.AddRange(