copy from BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpTypeSeriesMap.cs
copy to BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/AssetsPumpAndPartMapping.cs
Îļþ´Ó BLL/HStation.BLL.Assets.Core/03-localclient/01-PumpMainManage/PumpTypeSeriesMap.cs ¸´ÖÆ |
| | |
| | | /// <summary> |
| | | /// æ¥è¦ç级 |
| | | /// </summary> |
| | | public class AssetsPumpTypeSeriesMap : IAssetsPumpTypeSeriesMap |
| | | public class AssetsPumpAndPartMapping : IAssetsPumpMainAndPartMapping |
| | | { |
| | | private readonly HStation.Service.AssetsPumpTypeSeriesMapping _service = new(); |
| | | private readonly HStation.Service.AssetsPumpMainAndPartMapping _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | | public async Task<List<AssetsPumpTypeSeriesMapDto>> GetAll() |
| | | public async Task<List<AssetsPumpMainAndPartMapDto>> GetAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vm_list = list?.Select(x => new AssetsPumpTypeSeriesMapDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPumpMainAndPartMapDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | public async Task<AssetsPumpTypeSeriesMapDto> GetByID(long ID) |
| | | public async Task<AssetsPumpMainAndPartMapDto> GetByID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | return model == null ? null : new AssetsPumpTypeSeriesMapDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ç±»åID è·åææç³»åID |
| | | /// </summary> |
| | | public async Task<List<long>> GetSeriesIDByTypeID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | return _service.GetSeriesIDByTypeID(ID); |
| | | return model == null ? null : new AssetsPumpMainAndPartMapDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ Ids è·å |
| | | /// </summary> |
| | | public async Task<List<AssetsPumpTypeSeriesMapDto>> GetByIds(List<long> Ids) |
| | | public async Task<List<AssetsPumpMainAndPartMapDto>> GetByIds(List<long> Ids) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetByIds(Ids); |
| | | var vm_list = list?.Select(x => new AssetsPumpTypeSeriesMapDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPumpMainAndPartMapDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// æå
¥ä¸æ¡ |
| | | /// </summary> |
| | | public async Task<long> Insert(AddAssetsPumpTypeSeriesMapInput input) |
| | | public async Task<long> Insert(AddAssetsPumpMainAndPartMapInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = input.Adapt<AddAssetsPumpTypeSeriesMapInput, Model.AssetsPumpTypeSeriesMap>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var model = input.Adapt<AddAssetsPumpMainAndPartMapInput, Model.AssetsPumpMainAndPartMap>(); |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// æ¹éæå
¥ |
| | | /// </summary> |
| | | public async Task<bool> Inserts(List<AddAssetsPumpTypeSeriesMapInput> inputList) |
| | | public async Task<bool> Inserts(List<AddAssetsPumpMainAndPartMapInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = inputList.Select(x => x.Adapt<AddAssetsPumpTypeSeriesMapInput, Model.AssetsPumpTypeSeriesMap>()).ToList(); |
| | | list.ForEach(x => |
| | | { |
| | | x.SortCode = _service.GetMaxSortCode() + 1 + list.IndexOf(x); |
| | | }); |
| | | var list = inputList.Select(x => x.Adapt<AddAssetsPumpMainAndPartMapInput, Model.AssetsPumpMainAndPartMap>()).ToList(); |
| | | var bol = _service.Inserts(list); |
| | | return bol; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 大æ¹éæå
¥ |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddAssetsPumpTypeSeriesMapInput> list) |
| | | public async Task<bool> BulkInserts(List<AddAssetsPumpMainAndPartMapInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | public async Task<bool> Update(UpdateAssetsPumpTypeSeriesMapInput input) |
| | | public async Task<bool> Update(UpdateAssetsPumpMainAndPartMapInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} æ°æ®ä¸åå¨"); |
| | | } |
| | | |
| | | var rhs = new Model.AssetsPumpTypeSeriesMap(model); |
| | | var rhs = new Model.AssetsPumpMainAndPartMap(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | |
| | | /// <summary> |
| | | /// æ¹éæ´æ° |
| | | /// </summary> |
| | | public async Task<bool> Updates(List<UpdateAssetsPumpTypeSeriesMapInput> inputList) |
| | | public async Task<bool> Updates(List<UpdateAssetsPumpMainAndPartMapInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<UpdateAssetsPumpTypeSeriesMapInput, Model.AssetsPumpTypeSeriesMap>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<UpdateAssetsPumpMainAndPartMapInput, Model.AssetsPumpMainAndPartMap>()).ToList(); |
| | | var bol = _service.Updates(list); |
| | | return bol; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 大æ¹éæ´æ° |
| | | /// </summary> |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsPumpTypeSeriesMapInput> list) |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsPumpMainAndPartMapInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | return false; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æåºç |
| | | /// </summary> |
| | | public async Task<bool> UpdateSortCode(long ID, int SortCode) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var bol = _service.UpdateSortCode(ID, SortCode); |
| | | return bol; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°æåº |
| | | /// </summary> |
| | | public async Task<bool> UpdateSorter(List<UpdateSortCodeInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = inputList.Select(x => x.Adapt<Yw.Model.Sorter>()).ToList(); |
| | | var bol = _service.UpdateSorter(list); |
| | | return bol; |
| | | }); |
| | | } |
| | | |