diff --git a/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs b/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs new file mode 100644 index 00000000..88daa5f2 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs @@ -0,0 +1,109 @@ +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); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-报警区域表-1220132858.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-报警区域表-1220132858.zip new file mode 100644 index 00000000..e4e71bcd Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-报警区域表-1220132858.zip differ diff --git a/ZR.Model/MES/andon/AndonAlarmArea.cs b/ZR.Model/MES/andon/AndonAlarmArea.cs new file mode 100644 index 00000000..85b8acf3 --- /dev/null +++ b/ZR.Model/MES/andon/AndonAlarmArea.cs @@ -0,0 +1,51 @@ + +namespace ZR.Model.MES.andon +{ + /// + /// 报警区域表 + /// + [SugarTable("andon_alarm_area")] + public class AndonAlarmArea + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 父ID + /// + public int? ParentId { get; set; } + + /// + /// 区域名称 + /// + public string Area { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs b/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs new file mode 100644 index 00000000..044b33fe --- /dev/null +++ b/ZR.Model/MES/andon/Dto/AndonAlarmAreaDto.cs @@ -0,0 +1,35 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.andon.Dto +{ + /// + /// 报警区域表查询对象 + /// + public class AndonAlarmAreaQueryDto : PagerInfo + { + } + + /// + /// 报警区域表输入输出对象 + /// + public class AndonAlarmAreaDto + { + [Required(ErrorMessage = "主键不能为空")] + public int Id { get; set; } + + public int? ParentId { get; set; } + + public string Area { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/andon/AndonAlarmAreaService.cs b/ZR.Service/mes/andon/AndonAlarmAreaService.cs new file mode 100644 index 00000000..7b52d180 --- /dev/null +++ b/ZR.Service/mes/andon/AndonAlarmAreaService.cs @@ -0,0 +1,79 @@ +using Infrastructure.Attribute; +using SqlSugar; +using ZR.Model; +using ZR.Model.MES.andon; +using ZR.Model.MES.andon.Dto; +using ZR.Repository; +using ZR.Service.mes.andon.Iservice; + +namespace ZR.Service.mes.andon +{ + /// + /// 报警区域表Service业务层处理 + /// + [AppService(ServiceType = typeof(IAndonAlarmAreaService), ServiceLifetime = LifeTime.Transient)] + public class AndonAlarmAreaService : BaseService, IAndonAlarmAreaService + { + /// + /// 查询报警区域表列表 + /// + /// + /// + public PagedInfo GetList(AndonAlarmAreaQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public AndonAlarmArea GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加报警区域表 + /// + /// + /// + public AndonAlarmArea AddAndonAlarmArea(AndonAlarmArea model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改报警区域表 + /// + /// + /// + public int UpdateAndonAlarmArea(AndonAlarmArea model) + { + //var response = Update(w => w.Id == model.Id, it => new AndonAlarmArea() + //{ + // ParentId = model.ParentId, + // Area = model.Area, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs b/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs new file mode 100644 index 00000000..de8cec09 --- /dev/null +++ b/ZR.Service/mes/andon/IService/IAndonAlarmAreaService.cs @@ -0,0 +1,23 @@ +using System; +using ZR.Model; +using System.Collections.Generic; +using ZR.Model.MES.andon; +using ZR.Model.MES.andon.Dto; + + +namespace ZR.Service.mes.andon.Iservice + /// + /// 报警区域表service接口 + /// + public interface IAndonAlarmAreaService : IBaseService + { + PagedInfo GetList(AndonAlarmAreaQueryDto parm); + + AndonAlarmArea GetInfo(int Id); + + AndonAlarmArea AddAndonAlarmArea(AndonAlarmArea parm); + + int UpdateAndonAlarmArea(AndonAlarmArea parm); + + } +}