| | |
| | | /// <summary> |
| | | /// 报警等级 |
| | | /// </summary> |
| | | public class PumpPropContent : IPumpPropContent |
| | | public class AssetsPumpPropContent : IAssetsPumpPropContent |
| | | { |
| | | private readonly HStation.Service.PumpPropContent _service = new(); |
| | | private readonly HStation.Service.AssetsPumpPropContent _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// 获取所有 |
| | | /// </summary> |
| | | public async Task<List<PumpPropContentDto>> GetAll() |
| | | public async Task<List<AssetsPumpPropContentDto>> GetAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | 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> |
| | | /// 通过 ID 获取 |
| | | /// </summary> |
| | | public async Task<PumpPropContentDto> GetByID(long ID) |
| | | public async Task<AssetsPumpPropContentDto> GetByID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | return model == null ? null : new PumpPropContentDto(model); |
| | | return model == null ? null : new AssetsPumpPropContentDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 Ids 获取 |
| | | /// </summary> |
| | | public async Task<List<PumpPropContentDto>> GetByIds(List<long> Ids) |
| | | public async Task<List<AssetsPumpPropContentDto>> GetByIds(List<long> Ids) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | 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> |
| | | public async Task<List<PumpPropContentDto>> GetByPumpPartID(long pumpPartId) |
| | | public async Task<List<AssetsPumpPropContentDto>> GetByPumpPartID(long pumpPartId) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetByPartID(pumpPartId); |
| | | var vm_list = list?.Select(x => new PumpPropContentDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPumpPropContentDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 插入一条 |
| | | /// </summary> |
| | | public async Task<long> Insert(AddPumpPropContentInput input) |
| | | public async Task<long> Insert(AddAssetsPumpPropContentInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = input.Adapt<AddPumpPropContentInput, Model.PumpPropContent>(); |
| | | var model = input.Adapt<AddAssetsPumpPropContentInput, Model.AssetsPumpPropContent>(); |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 批量插入 |
| | | /// </summary> |
| | | public async Task<bool> Inserts(List<AddPumpPropContentInput> inputList) |
| | | public async Task<bool> Inserts(List<AddAssetsPumpPropContentInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | 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> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddPumpPropContentInput> list) |
| | | public async Task<bool> BulkInserts(List<AddAssetsPumpPropContentInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 更新一条 |
| | | /// </summary> |
| | | public async Task<bool> Update(UpdatePumpPropContentInput input) |
| | | public async Task<bool> Update(UpdateAssetsPumpPropContentInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | 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> |
| | | /// 批量更新 |
| | | /// </summary> |
| | | public async Task<bool> Updates(List<UpdatePumpPropContentInput> inputList) |
| | | public async Task<bool> Updates(List<UpdateAssetsPumpPropContentInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | { |
| | | 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; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 大批量更新 |
| | | /// </summary> |
| | | public async Task<bool> BulkUpdates(List<UpdatePumpPropContentInput> list) |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsPumpPropContentInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |