From cf377fa2427d5667dc48db2400e446bb64fdb58e Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 1 Nov 2022 11:58:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20webApi=20api/getDevice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/BuildController.cs | 28 +++++++++---------- FrontendWebApi/Models/Build.cs | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index 01f40f8..c704768 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -383,7 +383,7 @@ namespace FrontendWebApi.ApiControllers apiResult.Code = "5000"; return BadRequest(apiResult); } - if (post.building_guid == null) + if (post.building_tag == null) { apiResult.Code = "9997"; return Ok(apiResult); @@ -396,13 +396,13 @@ namespace FrontendWebApi.ApiControllers var disastersql = ""; var layer3sql = ""; var sWhere = ""; - if (!String.IsNullOrEmpty(post.main_system_guid)) + if (!String.IsNullOrEmpty(post.main_system_tag)) { - main_system_guidsql = $" and d.main_system_guid = '{post.main_system_guid}'"; + main_system_guidsql = $" and d.device_system_tag = '{post.main_system_tag}'"; } - if (!String.IsNullOrEmpty(post.sub_system_guid)) + if (!String.IsNullOrEmpty(post.sub_system_tag)) { - sub_system_guidsql = $" and d.sub_system_guid = '{post.sub_system_guid}'"; + sub_system_guidsql = $" and d.device_name_tag = '{post.sub_system_tag}'"; } if (!String.IsNullOrEmpty(post.device_system_category_layer3)) { @@ -417,13 +417,13 @@ namespace FrontendWebApi.ApiControllers if (!String.IsNullOrEmpty(post.show_cctv) && post.show_cctv == "1") { var str_arr = new List(); - if (!String.IsNullOrEmpty(post.main_system_guid)) + if (!String.IsNullOrEmpty(post.main_system_tag)) { - str_arr.Add($@"d.main_system_guid = '{post.main_system_guid}'"); + str_arr.Add($@"d.device_system_tag = '{post.main_system_tag}'"); } - if (!String.IsNullOrEmpty(post.sub_system_guid)) + if (!String.IsNullOrEmpty(post.sub_system_tag)) { - str_arr.Add($@"d.sub_system_guid = '{post.sub_system_guid}'"); + str_arr.Add($@"d.device_name_tag = '{post.sub_system_tag}'"); } if (!String.IsNullOrEmpty(post.device_system_category_layer3)) { @@ -495,12 +495,12 @@ namespace FrontendWebApi.ApiControllers and d.device_name_tag = dk.device_name_tag left join device_master dm ON d.device_building_tag = dm.device_building_tag AND d.device_name_tag = dm.device_name_tag - left join device_item di ON d.sub_system_guid = di.sub_system_guid + left join device_item di ON d.device_name_tag = di.device_name_tag AND di.deleted = 0 AND di.is_show_riserDiagram = 1 {disasterjoinsql} - LEFT JOIN building_menu bm ON d.building_guid = bm.building_guid AND d.main_system_guid = bm.main_system_guid AND d.sub_system_guid = bm.sub_system_guid - where d.deleted = 0 and d.building_guid = '{post.building_guid}' {sWhere} + LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag + where d.deleted = 0 and d.device_building_tag = '{post.building_tag}' {sWhere} order by d.priority ASC, d.device_number ASC"; var devicelist = await backendRepository.GetAllAsync(sql); @@ -521,9 +521,9 @@ namespace FrontendWebApi.ApiControllers } //抓出該設備所需要的顯示的即時資料(平面圖) - var sql_tips = $@"SELECT di.* FROM device_item di WHERE di.deleted = 0 AND is_show = 1 AND sub_system_guid = @sub_system_guid"; + var sql_tips = $@"SELECT di.* FROM device_item di WHERE di.deleted = 0 AND is_show = 1 AND device_name_tag = @sub_system_tag"; - var device_item_floormap = await backendRepository.GetAllAsync(sql_tips, new { sub_system_guid = post.sub_system_guid }); + var device_item_floormap = await backendRepository.GetAllAsync(sql_tips, new { sub_system_tag = post.sub_system_tag }); foreach (var device in devicelist) { diff --git a/FrontendWebApi/Models/Build.cs b/FrontendWebApi/Models/Build.cs index 5591711..89e17af 100644 --- a/FrontendWebApi/Models/Build.cs +++ b/FrontendWebApi/Models/Build.cs @@ -62,9 +62,9 @@ namespace FrontendWebApi.Models public class GetSubPost { - public string main_system_guid { get; set; } - public string sub_system_guid { get; set; } - public string building_guid { get; set; } + public string main_system_tag { get; set; } + public string sub_system_tag { get; set; } + public string building_tag { get; set; } public string device_system_value { get; set; } public string device_system_category_layer3 { get; set; } public string show_cctv { get; set; }