From 7ef789693e2e2ed6943f56999818be7b3fa26f08 Mon Sep 17 00:00:00 2001 From: dev01 Date: Sat, 12 Nov 2022 15:05:42 +0800 Subject: [PATCH] =?UTF-8?q?[FrontedWebApi][=E9=81=8B=E7=B6=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86]=20=E5=91=BD=E5=90=8D=20of=20=E6=94=B9=E7=82=BA=20ofi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/OperationController.cs | 30 +++++++++---------- FrontendWebApi/Models/Operation.cs | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs index 878e3de..f9fd2c1 100644 --- a/FrontendWebApi/ApiControllers/OperationController.cs +++ b/FrontendWebApi/ApiControllers/OperationController.cs @@ -273,11 +273,11 @@ namespace FrontendWebApi.ApiControllers if (string.IsNullOrEmpty(work_type.ToString())) { - var sqlString = $@"select of.*, v2.system_key - from operation_firm of - left join variable v1 on of.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.delted = 0 - left join variable v2 on v1.id = v2.system_parent_id and of.device_system_category_layer3 = v2.system_value and v2.system_type = @sub_system_type and v2.deleted = 0 - where of.deleted = 0"; + var sqlString = $@"select ofi.*, v2.system_key + from operation_firm ofi + left join variable v1 on ofi.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.delted = 0 + left join variable v2 on v1.id = v2.system_parent_id and ofi.device_system_category_layer3 = v2.system_value and v2.system_type = @sub_system_type and v2.deleted = 0 + where ofi.deleted = 0"; var sheet = workbook.CreateSheet("廠商資料"); var operation_firm = backendRepository.GetAllAsync(sqlString, null); int RowPosition = 0; @@ -659,7 +659,7 @@ namespace FrontendWebApi.ApiControllers { if (ofl.start_created_at != null || ofl.end_created_at != null) { - sWhere += $@" and (of.created_at >= ifnull(@start_created_at, of.created_at) AND of.created_at <= ifnull(@end_created_at, of.created_at))"; + sWhere += $@" and (ofi.created_at >= ifnull(@start_created_at, ofi.created_at) AND ofi.created_at <= ifnull(@end_created_at, ofi.created_at))"; } //else if (ofl.today) //{ @@ -672,7 +672,7 @@ namespace FrontendWebApi.ApiControllers if (ofl.sub_system_tag != null || ofl.main_system_tag != null) { - sWhere += $@" and (of.device_system_category_layer2 = ifnull(@main_system_tag, device_system_category_layer2) AND of.device_system_category_layer3 = ifnull(@sub_system_tag, device_system_category_layer3))"; + sWhere += $@" and (ofi.device_system_category_layer2 = ifnull(@main_system_tag, device_system_category_layer2) AND ofi.device_system_category_layer3 = ifnull(@sub_system_tag, device_system_category_layer3))"; } var sqlString = @$"select ofi.*, v2.system_key @@ -686,7 +686,7 @@ namespace FrontendWebApi.ApiControllers } else { - var sqlString = $@"select of.id, of.name from operation_firm where deleted = 0"; + var sqlString = $@"select ofi.id, ofi.name from operation_firm where deleted = 0"; opList = await backendRepository.GetAllAsync(sqlString); } @@ -714,11 +714,11 @@ namespace FrontendWebApi.ApiControllers Operation_Firm opList = new Operation_Firm(); try { - var sqlString = @$"select of.*, v2.system_key - from operation_firm of - left join variable v1 on of.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.deleted = 0 and of.device_system_category_layer2 = v1.system_value - left join variable v2 on v1.id = v2.system_parent_id and of.device_system_category_layer3 = v2.system_value and v2.deleted = 0 - where of.deleted = 0 and of.id = @id"; + var sqlString = @$"select ofi.*, v2.system_key + from operation_firm ofi + left join variable v1 on ofi.device_system_category_layer2 = v1.system_value and v1.system_type = @main_system_type and v1.deleted = 0 and ofi.device_system_category_layer2 = v1.system_value + left join variable v2 on v1.id = v2.system_parent_id and ofi.device_system_category_layer3 = v2.system_value and v2.deleted = 0 + where ofi.deleted = 0 and ofi.id = @id"; var param = new { @id = ofl.id }; opList = await backendRepository.GetOneAsync(sqlString, param); @@ -962,7 +962,7 @@ namespace FrontendWebApi.ApiControllers return apiResult; } - + #endregion #region 維修/保養 /// /// 維修/保養 讀取(work_type) @@ -1008,7 +1008,7 @@ namespace FrontendWebApi.ApiControllers return apiResult; } - + /// /// 維修/保養---新增/編輯 /// diff --git a/FrontendWebApi/Models/Operation.cs b/FrontendWebApi/Models/Operation.cs index 442a763..5a08c56 100644 --- a/FrontendWebApi/Models/Operation.cs +++ b/FrontendWebApi/Models/Operation.cs @@ -46,7 +46,7 @@ namespace FrontendWebApi.Models //public bool yesterday { get; set; }//昨天建立时间 public string main_system_tag { get; set; }//大类tag public string sub_system_tag { get; set; }//小类tag - public byte work_type { get; set; } // 1:保養, 2:維修 + public byte? work_type { get; set; } // 1:保養, 2:維修 } public class BuildingList