ÎļþÃû´Ó BLL/HStation.BLL.Assets.Core/03-localclient/12-Compressor/AssetsCompressorMainAndPartMapping.cs ÐÞ¸Ä |
| | |
| | | using Yw.Dto; |
| | | |
| | | namespace HStation.CAL.LocalClient |
| | | namespace HStation.CAL.LocalClient |
| | | { |
| | | /// <summary> |
| | | /// æ¥è¦ç级 |
| | | /// |
| | | /// </summary> |
| | | public class AssetsCompressorMainAndPartMapping : IAssetsCompressorMainAndPartMapping |
| | | public class AssetsCompressorFactor : IAssetsCompressorFactor |
| | | { |
| | | private readonly HStation.Service.AssetsCompressorMainAndPartMapping _service = new(); |
| | | private readonly HStation.Service.AssetsCompressorFactor _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | | public async Task<List<AssetsCompressorMainAndPartMapDto>> GetAll() |
| | | public async Task<List<AssetsCompressorFactorDto>> GetAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vm_list = list?.Select(x => new AssetsCompressorMainAndPartMapDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsCompressorFactorDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// éè¿ ID è·å |
| | | /// </summary> |
| | | public async Task<AssetsCompressorMainAndPartMapDto> GetByID(long ID) |
| | | public async Task<AssetsCompressorFactorDto> GetByID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | return model == null ? null : new AssetsCompressorMainAndPartMapDto(model); |
| | | return model == null ? null : new AssetsCompressorFactorDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ Ids è·å |
| | | /// </summary> |
| | | public async Task<List<AssetsCompressorMainAndPartMapDto>> GetByIds(List<long> Ids) |
| | | public async Task<List<AssetsCompressorFactorDto>> GetByIds(List<long> Ids) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetByIds(Ids); |
| | | var vm_list = list?.Select(x => new AssetsCompressorMainAndPartMapDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsCompressorFactorDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | | |
| | | #endregion Query |
| | | #endregion |
| | | |
| | | #region Insert |
| | | |
| | | /// <summary> |
| | | /// æå
¥ä¸æ¡ |
| | | /// </summary> |
| | | public async Task<long> Insert(AddAssetsCompressorMainAndPartMapInput input) |
| | | public async Task<long> Insert(AddAssetsCompressorFactorInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = input.Adapt<AddAssetsCompressorMainAndPartMapInput, Model.AssetsCompressorMainAndPartMapping>(); |
| | | var model = input.Adapt<AddAssetsCompressorFactorInput, Model.AssetsCompressorFactor>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// æ¹éæå
¥ |
| | | /// </summary> |
| | | public async Task<bool> Inserts(List<AddAssetsCompressorMainAndPartMapInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = inputList.Select(x => x.Adapt<AddAssetsCompressorMainAndPartMapInput, Model.AssetsCompressorMainAndPartMapping>()).ToList(); |
| | | var bol = _service.Inserts(list); |
| | | return bol; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 大æ¹éæå
¥ |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddAssetsCompressorMainAndPartMapInput> list) |
| | | public async Task<bool> Inserts(List<AddAssetsCompressorFactorInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | }); |
| | | } |
| | | |
| | | #endregion Insert |
| | | /// <summary> |
| | | /// 大æ¹éæå
¥ |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddAssetsCompressorFactorInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | return false; |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Update |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä¸æ¡ |
| | | /// </summary> |
| | | public async Task<bool> Update(UpdateAssetsCompressorMainAndPartMapInput input) |
| | | public async Task<bool> Update(UpdateAssetsCompressorFactorInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} æ°æ®ä¸åå¨"); |
| | | } |
| | | |
| | | var rhs = new Model.AssetsCompressorMainAndPartMapping(model); |
| | | var rhs = new Model.AssetsCompressorFactor(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | |
| | | /// <summary> |
| | | /// æ¹éæ´æ° |
| | | /// </summary> |
| | | public async Task<bool> Updates(List<UpdateAssetsCompressorMainAndPartMapInput> inputList) |
| | | public async Task<bool> Updates(List<UpdateAssetsCompressorFactorInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | if (inputList == null || inputList.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<UpdateAssetsCompressorMainAndPartMapInput, Model.AssetsCompressorMainAndPartMapping>()).ToList(); |
| | | var bol = _service.Updates(list); |
| | | return bol; |
| | | return false; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 大æ¹éæ´æ° |
| | | /// </summary> |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsCompressorMainAndPartMapInput> list) |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsCompressorFactorInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ç¼ç |
| | | /// æ´æ°æåºç |
| | | /// </summary> |
| | | public async Task<bool> UpdateCode(long ID, string Code) |
| | | public async Task<bool> UpdateSortCode(long ID, int SortCode) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | return false; |
| | | var bol = _service.UpdateSortCode(ID, SortCode); |
| | | return bol; |
| | | }); |
| | | } |
| | | |
| | | #endregion Update |
| | | /// <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; |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Delete |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | #endregion Delete |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |