using Infrastructure;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App.ServiceApp.FireManagement;
using OpenAuth.App.ServiceApp.FireManagement.Request;
using OpenAuth.App.ServiceApp.FmPreventionPlanManage;
using OpenAuth.App.ServiceApp.FmPreventionPlanManage.Request;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Domain.FireManagement;
namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
{
///
/// 防火应急预案模块
///
[Route("api/[controller]/[action]")]
[ApiController]
public class FmPreventionPlanController : ControllerBase
{
private readonly FmPreventionPlanApp _app;
public FmPreventionPlanController(FmPreventionPlanApp app)
{
_app = app;
}
///
/// 分页查询防火应急预案列表
///
///
[HttpGet]
public async Task>>> GetPreventionplanPageList([FromQuery] FmPreventionplanReq req)
{
Response>> response = new Response>>();
try
{
return await _app.GetPreventionplanPageList(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 查询应急预案详情
///
///
[HttpGet]
public async Task> LoadClueInfoById(string id)
{
Response response = new Response();
try
{
return await _app.LoadClueInfoById(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 添加预案
///
///
///
[HttpPost]
public async Task> AddPreventionplan(FmPreventionplan info)
{
Response response = new();
try
{
return await _app.AddPreventionplan(info);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
///
/// 删除预案
///
///
///
[HttpPost]
public async Task> DeletePreventionplan(string id)
{
Response response = new();
try
{
return await _app.DeletePreventionplan(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
}
}