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-20 namespace ZR.Admin.WebApi.Controllers.andon { /// /// 报警区域表 /// [AllowAnonymous] [Route("business/AndonAlarmArea")] public class AndonAlarmAreaController : BaseController { /// /// 报警区域表接口 /// private readonly IAndonAlarmAreaService _AndonAlarmAreaService; public AndonAlarmAreaController(IAndonAlarmAreaService AndonAlarmAreaService) { _AndonAlarmAreaService = AndonAlarmAreaService; } /// /// 查询报警区域表列表 /// /// /// [HttpGet("list")] [ActionPermissionFilter(Permission = "business:andonalarmarea:list")] public IActionResult QueryAndonAlarmArea([FromQuery] AndonAlarmAreaQueryDto parm) { var response = _AndonAlarmAreaService.GetList(parm); return SUCCESS(response); } /// /// 查询报警区域表详情 /// /// /// [HttpGet("{Id}")] [ActionPermissionFilter(Permission = "business:andonalarmarea:query")] public IActionResult GetAndonAlarmArea(int Id) { var response = _AndonAlarmAreaService.GetInfo(Id); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加报警区域表 /// /// [HttpPost] [ActionPermissionFilter(Permission = "business:andonalarmarea:add")] [Log(Title = "报警区域表", BusinessType = BusinessType.INSERT)] public IActionResult AddAndonAlarmArea([FromBody] AndonAlarmAreaDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _AndonAlarmAreaService.AddAndonAlarmArea(modal); return SUCCESS(response); } /// /// 更新报警区域表 /// /// [HttpPut] [ActionPermissionFilter(Permission = "business:andonalarmarea:edit")] [Log(Title = "报警区域表", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateAndonAlarmArea([FromBody] AndonAlarmAreaDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _AndonAlarmAreaService.UpdateAndonAlarmArea(modal); return ToResponse(response); } /// /// 删除报警区域表 /// /// [HttpDelete("{ids}")] [ActionPermissionFilter(Permission = "business:andonalarmarea:delete")] [Log(Title = "报警区域表", BusinessType = BusinessType.DELETE)] public IActionResult DeleteAndonAlarmArea(string ids) { int[] idsArr = Tools.SpitIntArrary(ids); if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } var response = _AndonAlarmAreaService.Delete(idsArr); return ToResponse(response); } } }