From 31547b227065f47fad0ef2eb77ab0ef4aef557f1 Mon Sep 17 00:00:00 2001 From: dev02 Date: Thu, 17 Nov 2022 15:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=B5=B1=E7=9B=A3?= =?UTF-8?q?=E6=8E=A7list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/DeviceManageController.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 7e2bc64..23583ff 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -62,11 +62,23 @@ namespace FrontendWebApi.ApiControllers var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); apiResult.Data = new History_MainSubBuildFloor(); apiResult.Data.history_Main_Systems = new List(); + foreach (var main in mains) { History_Main_system history_Main_System = new History_Main_system(); history_Main_System.main_system_tag = main.Select(a => a.main_system_tag).FirstOrDefault(); history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault(); + history_Main_System.History_Sub_systems = new List(); + + var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).ToList(); + foreach(var sub in subs) + { + History_Sub_system history_Sub_System = new History_Sub_system(); + history_Sub_System.sub_system_tag = sub.sub_system_tag; + history_Sub_System.full_name = sub.sub_name; + + history_Main_System.History_Sub_systems.Add(history_Sub_System); + } apiResult.Data.history_Main_Systems.Add(history_Main_System); }