| | |
| | | namespace HStation.Application |
| | | { |
| | | /// <summary> |
| | | /// PumpSeries |
| | | /// AssetsPumpSeries |
| | | /// </summary> |
| | | [Route("Assets/PumpPropContent")] |
| | | [ApiDescriptionSettings("Assets", Name = "PumpPropContent", Order = 500000)] |
| | | public class PumpPropContent_Controller : IDynamicApiController |
| | | [Route("Assets/AssetsPumpPropContent")] |
| | | [ApiDescriptionSettings("Assets", Name = "AssetsPumpPropContent", Order = 500000)] |
| | | public class AssetsPumpPropContent_Controller : IDynamicApiController |
| | | { |
| | | private readonly HStation.Service.PumpPropContent _service = new(); |
| | | private readonly HStation.Service.AssetsPumpPropContent _service = new(); |
| | | |
| | | #region Query |
| | | |
| | |
| | | /// </summary> |
| | | [Route("GetAll@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpPropContentDto> GetAll() |
| | | public List<AssetsPumpPropContentDto> GetAll() |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vm_list = list?.Select(x => new PumpPropContentDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPumpPropContentDto(x)).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [Route("GetByID@V1.0")] |
| | | [HttpGet] |
| | | public PumpPropContentDto GetByID([FromQuery][Required] IDInput input) |
| | | public AssetsPumpPropContentDto GetByID([FromQuery][Required] IDInput input) |
| | | { |
| | | var model = _service.GetByID(input.ID); |
| | | return model == null ? null : new PumpPropContentDto(model); |
| | | return model == null ? null : new AssetsPumpPropContentDto(model); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | [Route("GetByIds@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpPropContentDto> GetByIds([FromQuery][Required] IdsInput input) |
| | | public List<AssetsPumpPropContentDto> GetByIds([FromQuery][Required] IdsInput input) |
| | | { |
| | | var ids = LongListHelper.ToList(input.Ids); |
| | | var list = _service.GetByIds(ids); |
| | | var vm_list = list?.Select(x => new PumpPropContentDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPumpPropContentDto(x)).ToList(); |
| | | return vm_list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过产品ID 获取 |
| | | /// </summary> |
| | | [Route("GetByPumpPartID@V1.0")] |
| | | [HttpGet] |
| | | public List<PumpPropContentDto> GetByPumpPartID(long pumpPartId) |
| | | { |
| | | var list = _service.GetByPartID(pumpPartId); |
| | | var vm_list = list?.Select(x => new PumpPropContentDto(x)).ToList(); |
| | | return vm_list; |
| | | } |
| | | /* /// <summary> |
| | | /// 通过产品ID 获取 |
| | | /// </summary> |
| | | [Route("GetByPumpPartID@V1.0")] |
| | | [HttpGet] |
| | | public List<AssetsPumpPropContentDto> GetByPumpPartID(long pumpPartId) |
| | | { |
| | | var list = _service.GetByPartID(pumpPartId); |
| | | var vm_list = list?.Select(x => new AssetsPumpPropContentDto(x)).ToList(); |
| | | return vm_list; |
| | | }*/ |
| | | |
| | | #endregion Query |
| | | |
| | |
| | | /// </summary> |
| | | [Route("Insert@V1.0")] |
| | | [HttpPost] |
| | | public long Insert(AddPumpPropContentInput input) |
| | | public long Insert(AddAssetsPumpPropContentInput input) |
| | | { |
| | | var model = input.Adapt<AddPumpPropContentInput, Model.PumpPropContent>(); |
| | | var model = input.Adapt<AddAssetsPumpPropContentInput, Model.AssetsPumpPropContent>(); |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | } |
| | |
| | | /// </summary> |
| | | [Route("Inserts@V1.0")] |
| | | [HttpPost] |
| | | public bool Inserts(List<AddPumpPropContentInput> inputList) |
| | | public bool Inserts(List<AddAssetsPumpPropContentInput> inputList) |
| | | { |
| | | var list = inputList.Select(x => x.Adapt<AddPumpPropContentInput, Model.PumpPropContent>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<AddAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); |
| | | var bol = _service.Inserts(list); |
| | | return bol; |
| | | } |
| | |
| | | /// </summary> |
| | | [Route("Update@V1.0")] |
| | | [HttpPut] |
| | | public bool Update([Required] UpdatePumpPropContentInput input) |
| | | public bool Update([Required] UpdateAssetsPumpPropContentInput input) |
| | | { |
| | | var model = _service.GetByID(input.ID); |
| | | if (model == null) |
| | |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 数据不存在"); |
| | | } |
| | | |
| | | var rhs = new Model.PumpPropContent(model); |
| | | var rhs = new Model.AssetsPumpPropContent(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | |
| | | /// </summary> |
| | | [Route("Updates@V1.0")] |
| | | [HttpPut] |
| | | public bool Updates([Required] List<UpdatePumpPropContentInput> inputList) |
| | | public bool Updates([Required] List<UpdateAssetsPumpPropContentInput> inputList) |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<UpdatePumpPropContentInput, Model.PumpPropContent>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<UpdateAssetsPumpPropContentInput, Model.AssetsPumpPropContent>()).ToList(); |
| | | var bol = _service.Updates(list); |
| | | return bol; |
| | | } |