109 lines
3.6 KiB
C#
109 lines
3.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Admin.WebApi.Extensions;
|
||
using ZR.Admin.WebApi.Filters;
|
||
using ZR.Model.MES.andon;
|
||
using ZR.Model.MES.andon.Dto;
|
||
using ZR.Service.mes.andon.Iservice;
|
||
|
||
//创建时间:2025-12-10
|
||
namespace ZR.Admin.WebApi.Controllers.andon
|
||
{
|
||
/// <summary>
|
||
/// 报警联系人表
|
||
/// </summary>
|
||
[Route("mes/AndonAlarmContact")]
|
||
[AllowAnonymous]
|
||
public class AndonAlarmContactController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 报警联系人表接口
|
||
/// </summary>
|
||
private readonly IAndonAlarmContactService _AndonAlarmContactService;
|
||
|
||
public AndonAlarmContactController(IAndonAlarmContactService AndonAlarmContactService)
|
||
{
|
||
_AndonAlarmContactService = AndonAlarmContactService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询报警联系人表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "business:andonalarmcontact:list")]
|
||
public IActionResult QueryAndonAlarmContact([FromQuery] AndonAlarmContactQueryDto parm)
|
||
{
|
||
var response = _AndonAlarmContactService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询报警联系人表详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "business:andonalarmcontact:query")]
|
||
public IActionResult GetAndonAlarmContact(int Id)
|
||
{
|
||
var response = _AndonAlarmContactService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<AndonAlarmContact>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加报警联系人表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "business:andonalarmcontact:add")]
|
||
[Log(Title = "报警联系人表", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddAndonAlarmContact([FromBody] AndonAlarmContactDto parm)
|
||
{
|
||
var modal = parm.Adapt<AndonAlarmContact>().ToCreate(HttpContext);
|
||
|
||
var response = _AndonAlarmContactService.AddAndonAlarmContact(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新报警联系人表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "business:andonalarmcontact:edit")]
|
||
[Log(Title = "报警联系人表", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateAndonAlarmContact([FromBody] AndonAlarmContactDto parm)
|
||
{
|
||
var modal = parm.Adapt<AndonAlarmContact>().ToUpdate(HttpContext);
|
||
var response = _AndonAlarmContactService.UpdateAndonAlarmContact(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除报警联系人表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "business:andonalarmcontact:delete")]
|
||
[Log(Title = "报警联系人表", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteAndonAlarmContact(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _AndonAlarmContactService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |