From faa2ddca2f1688ee456aa3faf5a6b8be46c668dc Mon Sep 17 00:00:00 2001 From: dev01 Date: Thu, 18 May 2023 12:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=8C=E5=8F=B0=20[=E6=AD=B7=E5=8F=B2?= =?UTF-8?q?=E8=B3=87=E6=96=99]=20api=20=E7=A8=8B=E5=BA=8F=E8=AA=BF?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/HistoryController.cs | 8 ++++---- FrontendWebApi/Models/HistoryClass.cs | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 289a63c..6d60f63 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1137,7 +1137,7 @@ namespace FrontendWebApi.ApiControllers and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag and d.deleted = 0 - where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number + where di.deleted = 0 and di.unit is not null and d.device_number = @Device_number ) temp inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0 inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' @@ -1149,12 +1149,12 @@ namespace FrontendWebApi.ApiControllers var device_number = hi.Device_number_point.Split(":")[0]; var point = hi.Device_number_point.Split(":")[1]; //var tableName = await backgroundServiceMsSqlRepository.GetAllAsync($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}%'"); - var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = hi.Device_number_point }); + var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = device_number }); var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault(); var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name, - '{device_item_info.Sub_system_name}' as Sub_system_name', {device_item_info.Device_number}' as Device_number, + '{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} @@ -1167,7 +1167,7 @@ namespace FrontendWebApi.ApiControllers //{ //} } - + apiResult.Code = "0000"; apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList(); } catch (Exception exception) diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index ebdf803..79bc3a1 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -264,6 +264,7 @@ namespace FrontendWebApi.Models public class HistoryItem { public string Device_number_point { get; set; } + public string Device_number { get; set; } public string Unit { get; set; } }