| | |
| | | namespace HStation.Application |
| | | using Mapster; |
| | | |
| | | namespace HStation.Application |
| | | { |
| | | /// <summary> |
| | | /// AssetsPumpMain |
| | |
| | | //插入拓展 |
| | | [Route("InsertEx@V1.0")] |
| | | [HttpPost] |
| | | public long InsertEx(AddAssetsPumpPartMainInput part, List<AddAssetsPumpPropContentInput> propcontents, AddAssetsPumpMainAndPartMapInput partmap) |
| | | public long InsertEx(AddPumpPartMainExInput input) |
| | | { |
| | | var partmodel = part.Adapt<AddAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); |
| | | var partmodel = input.PartMain.Adapt<AddAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); |
| | | partmodel.SortCode = _service.GetMaxSortCode() + 1; |
| | | var propcontentlistmodel = propcontents.Select(x => x.Adapt<AddAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); |
| | | var partmapmodel = partmap.Adapt<AddAssetsPumpMainAndPartMapInput, Model.AssetsPumpMainAndPartMapping>(); |
| | | var propcontentlistmodel = input.PropContent.Select(x => x.Adapt<AddAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); |
| | | var partmapmodel = input.PartMapping.Adapt<AddAssetsPumpMainAndPartMapInput, Model.AssetsPumpMainAndPartMapping>(); |
| | | var id = _service.InsertEX(partmodel, propcontentlistmodel, partmapmodel); |
| | | return id; |
| | | } |
| | |
| | | |
| | | //编辑拓展 |
| | | [Route("UpdateEx@V1.0")] |
| | | [HttpPut] |
| | | public bool UpdateEx(UpdateAssetsPumpPartMainInput pumppart, List<UpdateAssetsPumpPropContentInput> updateAssetsPumpPropContentDtos) |
| | | [HttpPost] |
| | | public bool UpdateEx(UpdatePumpPartMainExInput input) |
| | | { |
| | | var partmodel = pumppart.Adapt<UpdateAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); |
| | | var propcontentlistmodel = updateAssetsPumpPropContentDtos.Select(x => x.Adapt<UpdateAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); |
| | | var partmodel = input.PartMain.Adapt<UpdateAssetsPumpPartMainInput, Model.AssetsPumpPartMain>(); |
| | | var propcontentlistmodel = input.PropContent.Select(x => x.Adapt<UpdateAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); |
| | | return _service.UpdateEX(partmodel, propcontentlistmodel); |
| | | } |
| | | |
| | |
| | | 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 |
| | | } |