From 869951fcf4f75e50c98b6e4f5a000e3ae0b25723 Mon Sep 17 00:00:00 2001 From: dev01 Date: Sat, 12 Nov 2022 16:41:30 +0800 Subject: [PATCH] =?UTF-8?q?[FrontedWebApi][=E9=81=8B=E7=B6=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86]=20=E5=BB=A0=E5=95=86=E5=88=97=E8=A1=A8sql=E8=AA=BF?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/OperationController.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs index ea4ae71..028d8ce 100644 --- a/FrontendWebApi/ApiControllers/OperationController.cs +++ b/FrontendWebApi/ApiControllers/OperationController.cs @@ -107,9 +107,9 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select system_value as device_area_tag, system_key as area_name from variable where system_type = 'area' and deleted = 0"; + var sqlString = $@"select system_value as device_area_tag, system_key as area_name from variable where system_type = 'area' and deleted = 0"; - bl = await backendRepository.GetAllAsync(sqlString, null); + bl = await backendRepository.GetAllAsync(sqlString); apiResult.Code = "0000"; apiResult.Data = bl; @@ -136,10 +136,10 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = @$"select d.device_building_tag, b.full_name as building_name + var sqlString = @$"select b.building_tag, b.full_name as building_name from building b where deleted = 0 and area_tag = @device_area_tag - group by b.full_name, d.device_building_tag"; + group by b.full_name, b.building_tag"; bl = await backendRepository.GetAllAsync(sqlString, new { @device_area_tag = b.device_area_tag }); @@ -224,8 +224,7 @@ namespace FrontendWebApi.ApiControllers /// 汇出excel (work_type: null=廠商, 1=保養, 2=維修) /// /// - [HttpPost] - public FileResult OpeExportExcel([FromBody] byte? work_type) + public FileResult OpeExportExcel([FromQuery] byte? work_type) { var workbook = new XSSFWorkbook(); #region excel設定 @@ -680,7 +679,7 @@ namespace FrontendWebApi.ApiControllers 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" + sWhere; - var param = new { @sub_system_type = sub_system_type, @start_created_at = ofl.start_created_at, @end_created_at = ofl.end_created_at, @sub_system_tag = ofl.sub_system_tag, @main_system_tag = ofl.main_system_tag }; + var param = new { @main_system_type = main_system_type, @sub_system_type = sub_system_type, @start_created_at = ofl.start_created_at, @end_created_at = ofl.end_created_at, @sub_system_tag = ofl.sub_system_tag, @main_system_tag = ofl.main_system_tag }; opList = await backendRepository.GetAllAsync(sqlString, param); } else