From 788989a0e2a5480a782b13e783ae1c2e909e7069 Mon Sep 17 00:00:00 2001 From: "jay.chang" Date: Tue, 27 Feb 2024 11:01:32 +0800 Subject: [PATCH] =?UTF-8?q?[Webapi]=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AA=9E=E6=B3=95Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/TenantBillController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FrontendWebApi/ApiControllers/TenantBillController.cs b/FrontendWebApi/ApiControllers/TenantBillController.cs index c60292a..f98ef55 100644 --- a/FrontendWebApi/ApiControllers/TenantBillController.cs +++ b/FrontendWebApi/ApiControllers/TenantBillController.cs @@ -269,7 +269,7 @@ namespace FrontendWebApi.ApiControllers // 找出資料庫存在的水電月份表 string checkTabelSql = $@"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_SCHEMA = 'ibms_dome_dome' and TABLE_NAME like 'archive_electric_water_meter_day_%'"; + WHERE TABLE_SCHEMA like 'ibms_dome_%' and TABLE_NAME like 'archive_electric_water_meter_day_%'"; var existTable = await backendRepository.GetAllAsync(checkTabelSql); for (var i = 0; i <= monthsApart; i++) @@ -477,7 +477,8 @@ namespace FrontendWebApi.ApiControllers FROM archive_electric_meter_tenant_bill a JOIN archive_electric_meter_tenant_list b ON a.tenant_guid = b.tenant_guid join device c on a.device_number = c.device_number - where {building_tag} "; + where {building_tag} + GROUP BY a.tenant_name;"; outputBill = await backendRepository.GetAllAsync(sqlString); string filePath = CreateOutputForm(outputBill);