From fa3b4f4b277a72f51f66bf918e850d88aff7baf9 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 20 十二月 2024 09:00:04 +0800 Subject: [PATCH] 换热器曲线 --- Application/HStation.Application.Assets.Core/01-ProjectProduct/PumpPart_Controller.cs | 96 +++++++++++++++++++++++++----------------------- 1 files changed, 50 insertions(+), 46 deletions(-) diff --git a/Application/HStation.Application.Assets.Core/01-ProjectProduct/PumpPart_Controller.cs b/Application/HStation.Application.Assets.Core/01-ProjectProduct/PumpPart_Controller.cs index 3b17943..bd6cbac 100644 --- a/Application/HStation.Application.Assets.Core/01-ProjectProduct/PumpPart_Controller.cs +++ b/Application/HStation.Application.Assets.Core/01-ProjectProduct/PumpPart_Controller.cs @@ -1,16 +1,15 @@ -锘縰sing Furion.RemoteRequest; -using HStation.Dto.Assets; +锘縰sing HStation.Dto.Assets; namespace HStation.Application { /// <summary> - /// PumpMain + /// AssetsPumpMain /// </summary> [Route("Assets/PumpPart")] - [ApiDescriptionSettings("Assets", Name = "璧勪骇", Order = 70000)] + [ApiDescriptionSettings("Assets", Name = "PumpPart", Order = 600000)] public class PumpPart_Controller : IDynamicApiController { - private readonly HStation.Service.PumpPartMain _service = new(); + private readonly HStation.Service.AssetsPumpPartMain _service = new(); #region Query @@ -19,10 +18,10 @@ /// </summary> [Route("GetAll@V1.0")] [HttpGet] - public List<PumpPartMainDto> GetAll() + public List<AssetsPumpPartMainDto> GetAll() { var list = _service.GetAll(); - var vm_list = list?.Select(x => new PumpPartMainDto(x)).ToList(); + var vm_list = list?.Select(x => new AssetsPumpPartMainDto(x)).ToList(); return vm_list; } @@ -31,10 +30,10 @@ /// </summary> [Route("GetByID@V1.0")] [HttpGet] - public PumpPartMainDto GetByID(long ID) + public AssetsPumpPartMainDto GetByID([FromQuery][Required] IDInput input) { - var model = _service.GetByID(ID); - return model == null ? null : new PumpPartMainDto(model); + var model = _service.GetByID(input.ID); + return model == null ? null : new AssetsPumpPartMainDto(model); } /// <summary> @@ -42,10 +41,11 @@ /// </summary> [Route("GetByIds@V1.0")] [HttpGet] - public List<PumpPartMainDto> GetByIds(List<long> Ids) + public List<AssetsPumpPartMainDto> GetByIds([FromQuery][Required] IdsInput input) { - var list = _service.GetByIds(Ids); - var vm_list = list?.Select(x => new PumpPartMainDto(x)).ToList(); + var ids = LongListHelper.ToList(input.Ids); + var list = _service.GetByIds(ids); + var vm_list = list?.Select(x => new AssetsPumpPartMainDto(x)).ToList(); return vm_list; } @@ -54,10 +54,10 @@ /// </summary> [Route("GetByPumpMainID@V1.0")] [HttpGet] - public List<PumpPartMainDto> GetByPumpMainID(long ID) + public List<AssetsPumpPartMainDto> GetByPumpMainID(long ID) { var list = _service.GetByMainID(ID); - var vm_list = list?.Select(x => new PumpPartMainDto(x)).ToList(); + var vm_list = list?.Select(x => new AssetsPumpPartMainDto(x)).ToList(); return vm_list; } @@ -70,9 +70,9 @@ /// </summary> [Route("Insert@V1.0")] [HttpPost] - public long Insert(AddPumpPartMainDto input) + public long Insert(AddAssetsPumpPartMainInput input) { - var model = input.Adapt<AddPumpPartMainDto, Model.PumpPartMain>(); + var model = input.Adapt<AddAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); model.SortCode = _service.GetMaxSortCode() + 1; var id = _service.Insert(model); return id; @@ -83,9 +83,9 @@ /// </summary> [Route("Inserts@V1.0")] [HttpPost] - public bool Inserts(List<AddPumpPartMainDto> inputList) + public bool Inserts(List<AddAssetsPumpPartMainInput> inputList) { - var list = inputList.Select(x => x.Adapt<AddPumpPartMainDto, Model.PumpPartMain>()).ToList(); + var list = inputList.Select(x => x.Adapt<AddAssetsPumpPartMainInput, Model.AssetsPumpPartMain>()).ToList(); list.ForEach(x => { x.SortCode = _service.GetMaxSortCode() + 1 + list.IndexOf(x); @@ -97,12 +97,12 @@ //鎻掑叆鎷撳睍 [Route("InsertEx@V1.0")] [HttpPost] - public long InsertEx(AddPumpPartMainDto part, List<AddPumpPropContentDto> propcontents, AddPumpMainAndPartMapDto partmap) + public long InsertEx(AddAssetsPumpPartMainInput part, List<AddAssetsPumpPropContentInput> propcontents, AddAssetsPumpMainAndPartMapInput partmap) { - var partmodel = part.Adapt<AddPumpPartMainDto, Model.PumpPartMain>(); + var partmodel = part.Adapt<AddAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); partmodel.SortCode = _service.GetMaxSortCode() + 1; - var propcontentlistmodel = propcontents.Select(x => x.Adapt<AddPumpPropContentDto, Model.PumpPropContent>()).ToList(); - var partmapmodel = partmap.Adapt<AddPumpMainAndPartMapDto, Model.PumpMainAndPartMap>(); + var propcontentlistmodel = propcontents.Select(x => x.Adapt<AddAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); + var partmapmodel = partmap.Adapt<AddAssetsPumpMainAndPartMapInput, Model.AssetsPumpMainAndPartMapping>(); var id = _service.InsertEX(partmodel, propcontentlistmodel, partmapmodel); return id; } @@ -116,7 +116,7 @@ /// </summary> [Route("Update@V1.0")] [HttpPut] - public bool Update(UpdatePumpPartMainDto input) + public bool Update([Required] UpdateAssetsPumpPartMainInput input) { var model = _service.GetByID(input.ID); if (model == null) @@ -124,7 +124,7 @@ throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 鏁版嵁涓嶅瓨鍦�"); } - var rhs = new Model.PumpPartMain(model); + var rhs = new Model.AssetsPumpPartMain(model); input.Adapt(rhs); var bol = _service.Update(rhs); return bol; @@ -135,13 +135,13 @@ /// </summary> [Route("Updates@V1.0")] [HttpPut] - public bool Updates(List<UpdatePumpPartMainDto> inputList) + public bool Updates([Required] List<UpdateAssetsPumpPartMainInput> inputList) { if (inputList == null || inputList.Count < 1) { return false; } - var list = inputList.Select(x => x.Adapt<UpdatePumpPartMainDto, Model.PumpPartMain>()).ToList(); + var list = inputList.Select(x => x.Adapt<UpdateAssetsPumpPartMainInput, Model.AssetsPumpPartMain>()).ToList(); var bol = _service.Updates(list); return bol; } @@ -149,10 +149,10 @@ //缂栬緫鎷撳睍 [Route("UpdateEx@V1.0")] [HttpPut] - public bool UpdateEx(UpdatePumpPartMainDto pumppart, List<UpdatePumpPropContentDto> updatePumpPropContentDtos) + public bool UpdateEx(UpdateAssetsPumpPartMainInput pumppart, List<UpdateAssetsPumpPropContentInput> updateAssetsPumpPropContentDtos) { - var partmodel = pumppart.Adapt<UpdatePumpPartMainDto, Model.PumpPartMain>(); - var propcontentlistmodel = updatePumpPropContentDtos.Select(x => x.Adapt<UpdatePumpPropContentDto, Model.PumpPropContent>()).ToList(); + var partmodel = pumppart.Adapt<UpdateAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); + var propcontentlistmodel = updateAssetsPumpPropContentDtos.Select(x => x.Adapt<UpdateAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); return _service.UpdateEX(partmodel, propcontentlistmodel); } @@ -161,9 +161,9 @@ /// </summary> [Route("UpdateSortCode@V1.0")] [HttpPut] - public bool UpdateSortCode(long ID, int SortCode) + public bool UpdateSortCode([Required] UpdateSortCodeInput input) { - var bol = _service.UpdateSortCode(ID, SortCode); + var bol = _service.UpdateSortCode(input.ID, input.SortCode); return bol; } @@ -172,8 +172,12 @@ /// </summary> [Route("UpdateSorter@V1.0")] [HttpPut] - public bool UpdateSorter(List<UpdateSortCodeInput> inputList) + public bool UpdateSorter([Required] List<UpdateSortCodeInput> inputList) { + if (inputList == null || inputList.Count < 1) + { + return false; + } var list = inputList.Select(x => x.Adapt<Yw.Model.Sorter>()).ToList(); var bol = _service.UpdateSorter(list); return bol; @@ -188,9 +192,9 @@ /// </summary> [Route("DeleteByID@V1.0")] [HttpDelete] - public bool DeleteByID(long ID) + public bool DeleteByID([FromQuery][Required] IDInput input) { - var bol = _service.DeleteByID(ID, out string msg); + var bol = _service.DeleteByID(input.ID, out string msg); if (!bol) { throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, msg); @@ -198,17 +202,17 @@ return true; } - [Route("DeleteEx@V1.0")] - [HttpDelete] - public bool DeleteEx(long ID) - { - var bol = _service.DeleteExByID(ID); - if (!bol) - { - throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, "鍒犻櫎澶辫触"); - } - return true; - } + /* [Route("DeleteEx@V1.0")] + [HttpDelete] + public bool DeleteEx(long ID) + { + var bol = _service.DeleteExByID(ID); + if (!bol) + { + throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, "鍒犻櫎澶辫触"); + } + return true; + }*/ #endregion Delete } -- Gitblit v1.9.3