From 393a2d38d037ad782401315c120801890631c6c2 Mon Sep 17 00:00:00 2001 From: "mjmUser\\mjmTech" Date: Thu, 9 Feb 2023 16:10:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=AD=B7=E5=8F=B2=E8=A8=8A?= =?UTF-8?q?=E6=81=AF=20=E5=B7=A6=E7=AB=AF=E9=81=B8=E5=96=AE=E5=88=A4?= =?UTF-8?q?=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/HistoryController.cs | 12 +++++++++--- FrontendWebApi/Models/HistoryClass.cs | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 0584e70..db21123 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -198,13 +198,15 @@ namespace FrontendWebApi.ApiControllers { var dbsub = await frontendRepository.GetAllAsync( @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority, - d.device_number, d.full_name as device_full_name, d.device_serial_tag + d.device_number, d.full_name as device_full_name, d.device_serial_tag ,di.is_show_history device_item_is_show_hsitory from role_auth a join auth_page b on a.AuthCode = b.AuthCode join userinfo c on c.role_guid = a.role_guid join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0 and d.visible = 1 + join device_item di on d.device_system_tag=di.device_system_tag and d.device_name_tag=di.device_name_tag + and di.is_link = 1 where c.account = @account order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type }); var dbbuilding = await frontendRepository.GetAllAsync( @@ -231,7 +233,7 @@ namespace FrontendWebApi.ApiControllers History_Sub_system history_Sub_System = new History_Sub_system(); history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault(); history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault(); - + history_Sub_System.is_show_history = sub.Select(x => x.device_item_is_show_hsitory).FirstOrDefault(); var devices = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault() && x.sub_system_tag == sub.Select(x => x.sub_system_tag).FirstOrDefault() && x.device_number != null).ToList(); history_Sub_System.device = devices.Count > 0 ? new List() : null; @@ -244,7 +246,11 @@ namespace FrontendWebApi.ApiControllers history_Sub_System.device.Add(device); } - history_Main_System.History_Sub_systems.Add(history_Sub_System); + if (history_Sub_System.is_show_history==1) + { + history_Main_System.History_Sub_systems.Add(history_Sub_System); + } + } apiResult.Data.history_Main_Systems.Add(history_Main_System); } diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index e292adc..8a9ffe9 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -78,6 +78,7 @@ namespace FrontendWebApi.Models public string device_item_points { get; set; } public string device_item_unit { get; set; } public byte device_item_is_show { get; set; } + public byte device_item_is_show_hsitory { get; set; } public byte device_item_is_show_riserDiagram { get; set; } public byte device_item_is_controll { get; set; } public byte device_item_is_bool { get; set; } @@ -126,6 +127,7 @@ namespace FrontendWebApi.Models } public class History_Sub_system { + public byte is_show_history { get; set; } public string sub_system_tag { get; set; } public string full_name { get; set; } public string device_normal_color { get; set; }