ibms-dome/FrontendWebApi/ApiControllers/DashboardController.cs

72 lines
2.4 KiB
C#
Raw Normal View History

2022-12-07 09:25:43 +08:00
using FrontendWebApi.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
2023-01-10 16:05:29 +08:00
using Microsoft.AspNetCore.Routing;
2022-12-07 09:25:43 +08:00
using Microsoft.Extensions.Logging;
using NPOI.SS.Formula.Functions;
using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface;
using System;
2023-01-10 16:05:29 +08:00
using System.Collections.Generic;
2022-12-07 09:25:43 +08:00
using System.Data.SqlTypes;
using System.IO;
using System.Threading.Tasks;
2023-01-12 18:04:20 +08:00
using System.Text;
2022-12-07 09:25:43 +08:00
namespace FrontendWebApi.ApiControllers
{
public class DashboardController : MyBaseApiController<GraphManageController>
{
private readonly IBackendRepository backendRepository;
private readonly IFrontendRepository frontendRepository;
public DashboardController(IBackendRepository backendRepository, IFrontendRepository frontendRepository)
{
this.backendRepository = backendRepository;
this.frontendRepository = frontendRepository;
}
[HttpPost]
public async Task<ActionResult<ApiResult<WorkOrderGraph>>> DashAlert()
{
ApiResult<WorkOrderGraph> apiResult = new ApiResult<WorkOrderGraph>();
try
{
var sqlString = $@"select ";
//apiResult.Data = ;
apiResult.Code = "0000";
}
catch (Exception exception)
{
apiResult.Code = "9999";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
return Ok(apiResult);
}
return Ok(apiResult);
}
2023-01-10 16:05:29 +08:00
[HttpPost]
[Route("api/AlarmCard")]
public async Task<ActionResult<ApiResult<List<VAlarmRecord>>>> AlarmCard()
{
ApiResult<List<VAlarmRecord>> apiResult = new ApiResult<List<VAlarmRecord>>();
try
{
var sqlString = $@"select * from v_alarm where isOpen = 1";
var result = await backendRepository.GetAllAsync<VAlarmRecord>(sqlString);
apiResult.Data = result;
apiResult.Code = "0000";
}
catch (Exception exception)
{
apiResult.Code = "9999";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
return Ok(apiResult);
}
return Ok(apiResult);
}
2022-12-07 09:25:43 +08:00
}
}