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-23 namespace ZR.Admin.WebApi.Controllers.andon { /// /// 安灯警报区三色灯IP字典 /// [Route("mes/AndonAlarmAreaLightDic")] [AllowAnonymous] public class AndonAlarmAreaLightDicController : BaseController { /// /// 安灯警报区三色灯IP字典接口 /// private readonly IAndonAlarmAreaLightDicService _AndonAlarmAreaLightDicService; public AndonAlarmAreaLightDicController(IAndonAlarmAreaLightDicService AndonAlarmAreaLightDicService) { _AndonAlarmAreaLightDicService = AndonAlarmAreaLightDicService; } /// /// 查询安灯警报区三色灯IP字典列表 /// /// /// [HttpGet("list")] [ActionPermissionFilter(Permission = "business:andonalarmarealightdic:list")] public IActionResult QueryAndonAlarmAreaLightDic([FromQuery] AndonAlarmAreaLightDicQueryDto parm) { var response = _AndonAlarmAreaLightDicService.GetList(parm); return SUCCESS(response); } /// /// 查询安灯警报区三色灯IP字典详情 /// /// /// [HttpGet("{Id}")] [ActionPermissionFilter(Permission = "business:andonalarmarealightdic:query")] public IActionResult GetAndonAlarmAreaLightDic(int Id) { var response = _AndonAlarmAreaLightDicService.GetInfo(Id); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加安灯警报区三色灯IP字典 /// /// [HttpPost] [ActionPermissionFilter(Permission = "business:andonalarmarealightdic:add")] [Log(Title = "安灯警报区三色灯IP字典", BusinessType = BusinessType.INSERT)] public IActionResult AddAndonAlarmAreaLightDic([FromBody] AndonAlarmAreaLightDicDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _AndonAlarmAreaLightDicService.AddAndonAlarmAreaLightDic(modal); return SUCCESS(response); } /// /// 更新安灯警报区三色灯IP字典 /// /// [HttpPut] [ActionPermissionFilter(Permission = "business:andonalarmarealightdic:edit")] [Log(Title = "安灯警报区三色灯IP字典", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateAndonAlarmAreaLightDic([FromBody] AndonAlarmAreaLightDicDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _AndonAlarmAreaLightDicService.UpdateAndonAlarmAreaLightDic(modal); return ToResponse(response); } /// /// 删除安灯警报区三色灯IP字典 /// /// [HttpDelete("{ids}")] [ActionPermissionFilter(Permission = "business:andonalarmarealightdic:delete")] [Log(Title = "安灯警报区三色灯IP字典", BusinessType = BusinessType.DELETE)] public IActionResult DeleteAndonAlarmAreaLightDic(string ids) { int[] idsArr = Tools.SpitIntArrary(ids); if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } var response = _AndonAlarmAreaLightDicService.Delete(idsArr); return ToResponse(response); } } }