diff --git a/FrontendWebApi/ApiControllers/DashboardController.cs b/FrontendWebApi/ApiControllers/DashboardController.cs index 5baa9f4..07999c6 100644 --- a/FrontendWebApi/ApiControllers/DashboardController.cs +++ b/FrontendWebApi/ApiControllers/DashboardController.cs @@ -67,5 +67,35 @@ namespace FrontendWebApi.ApiControllers } return Ok(apiResult); } + + [HttpPost] + [Route("api/Dashboard/GetTotalElec")] + public async Task>>> GetTotalElec() + { + ApiResult> apiResult = new ApiResult>(); + try + { + var sqlString = $@"SELECT + system_key AS 'building_tag', + system_value AS 'device_number', + system_remark AS 'remark' + FROM variable + WHERE + system_type = 'dashboard_total_elec' + AND deleted = '0'"; + var ess = await backendRepository.GetAllAsync(sqlString); + + apiResult.Code = "0000"; + apiResult.Data = ess; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + return Ok(apiResult); + } + return Ok(apiResult); + } } } diff --git a/FrontendWebApi/Models/Dashboard.cs b/FrontendWebApi/Models/Dashboard.cs index 2214668..723b0e2 100644 --- a/FrontendWebApi/Models/Dashboard.cs +++ b/FrontendWebApi/Models/Dashboard.cs @@ -7,4 +7,11 @@ public int DispatchCnt{ get; set; } public int NotDispatchCnt { get; set; } } + + public class TotalElec + { + public string building_tag { get; set; } + public string device_number { get; set; } + public string remark { get; set; } + } }