using Microsoft.AspNetCore.Mvc; using System.Net; using System.Net.Http.Headers; using Microsoft.Extensions.Hosting.Internal; using Microsoft.AspNetCore.Http.Extensions; using IStation.Untity; using Furion.DynamicApiController; using System.ComponentModel.DataAnnotations; using Mapster; namespace IStation.Application { /// /// ProductModifyRecord /// [Route("Product/ProductModifyRecord/Logic")] [ApiDescriptionSettings("Product", Name = "设备变更记录(业务)", Order = 589)] public class ProductModifyRecord_LogicController : IDynamicApiController { private Service.ProductModifyRecord _service = new Service.ProductModifyRecord(); /// /// 通过 ProductID 获取内容列表 /// [Route("GetContentByProductID@V1.0")] [HttpGet] public List GetContentByProductID([Required][FromQuery] ProductIDUnderCorpInput input) { var list = _service.GetByProductID(input.CorpID, input.ProductID); if (list == null || list.Count < 1) return default; var serviceFile = new Service.AttachmentFile(); var vmList = list.Select(x=>new ProductModifyRecordContentLogicDto(x, ()=>serviceFile.GetCountByAttachTypeAndAttachID(x.CorpID,IStation.ObjectType.ProductModifyRecord,x.ID))).ToList(); return vmList; } /// /// 通过 ProductID 获取列表 /// [Route("GetByProductID@V1.0")] [HttpGet] public List GetByProductID([Required][FromQuery] ProductIDUnderCorpInput input) { var list = _service.GetByProductID(input.CorpID, input.ProductID); if (list == null || list.Count < 1) return default; var serviceFile = new Service.AttachmentFile(); var serviceUser = new Service.User(); var vmList = list.Select(x => new ProductModifyRecordLogicDto(x, () => serviceFile.GetCountByAttachTypeAndAttachID(x.CorpID, IStation.ObjectType.ProductModifyRecord, x.ID), (id)=>serviceUser.GetByID(id)?.RealName)).ToList(); return vmList; } } }