| | |
| | | /// <summary> |
| | | /// 获取所有 |
| | | /// </summary> |
| | | public async Task<List<PipeLineMainDto>> GetAll() |
| | | public async Task<List<AssetsPipeMainDto>> GetAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vm_list = list?.Select(x => new PipeLineMainDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPipeMainDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 通过 ID 获取 |
| | | /// </summary> |
| | | public async Task<PipeLineMainDto> GetByID(long ID) |
| | | public async Task<AssetsPipeMainDto> GetByID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | return model == null ? null : new PipeLineMainDto(model); |
| | | return model == null ? null : new AssetsPipeMainDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 Ids 获取 |
| | | /// </summary> |
| | | public async Task<List<PipeLineMainDto>> GetByIds(List<long> Ids) |
| | | public async Task<List<AssetsPipeMainDto>> GetByIds(List<long> Ids) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetByIds(Ids); |
| | | var vm_list = list?.Select(x => new PipeLineMainDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsPipeMainDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 通过 系列ID 获取 |
| | | /// </summary> |
| | | public async Task<List<PipeLineMainDto>> GetBySeriesID(long ID) |
| | | public async Task<List<AssetsPipeMainDto>> GetBySeriesID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetBySeriesID(ID); |
| | | var vm_list = model?.Select(x => new PipeLineMainDto(x)).ToList(); |
| | | var vm_list = model?.Select(x => new AssetsPipeMainDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 插入一条 |
| | | /// </summary> |
| | | public async Task<long> Insert(AddPipeLineMainInput input) |
| | | public async Task<long> Insert(AddAssetsPipeMainInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = input.Adapt<AddPipeLineMainInput, Model.PipeLineMain>(); |
| | | var model = input.Adapt<AddAssetsPipeMainInput, Model.AssetsPipeMain>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var id = _service.Insert(model); |
| | | return id; |
| | |
| | | /// <summary> |
| | | /// 批量插入 |
| | | /// </summary> |
| | | public async Task<bool> Inserts(List<AddPipeLineMainInput> inputList) |
| | | public async Task<bool> Inserts(List<AddAssetsPipeMainInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = inputList.Select(x => x.Adapt<AddPipeLineMainInput, Model.PipeLineMain>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<AddAssetsPipeMainInput, Model.AssetsPipeMain>()).ToList(); |
| | | list.ForEach(x => |
| | | { |
| | | x.SortCode = _service.GetMaxSortCode() + 1 + list.IndexOf(x); |
| | | }); |
| | | var bol = _service.Inserts(list); |
| | | return bol; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddPipeLineMainInput> list) |
| | | public async Task<bool> BulkInserts(List<AddAssetsPipeMainInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 更新一条 |
| | | /// </summary> |
| | | public async Task<bool> Update(UpdatePipeLineMainInput input) |
| | | public async Task<bool> Update(UpdateAssetsPipeMainInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 数据不存在"); |
| | | } |
| | | |
| | | var rhs = new Model.PipeLineMain(model); |
| | | var rhs = new Model.AssetsPipeMain(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新默认值状态 |
| | | /// </summary> |
| | | public async Task<bool> UpdateDefaultStatus(long ID, bool status) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | if (model == null) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{ID} 数据不存在"); |
| | | } |
| | | var bol = _service.UpdateDefaultStatus(ID, status); |
| | | return bol; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 批量更新 |
| | | /// </summary> |
| | | public async Task<bool> Updates(List<UpdatePipeLineMainInput> inputList) |
| | | public async Task<bool> Updates(List<UpdateAssetsPipeMainInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | { |
| | | return false; |
| | | } |
| | | var list = inputList.Select(x => x.Adapt<UpdatePipeLineMainInput, Model.PipeLineMain>()).ToList(); |
| | | var list = inputList.Select(x => x.Adapt<UpdateAssetsPipeMainInput, Model.AssetsPipeMain>()).ToList(); |
| | | var bol = _service.Updates(list); |
| | | return bol; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 大批量更新 |
| | | /// </summary> |
| | | public async Task<bool> BulkUpdates(List<UpdatePipeLineMainInput> list) |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsPipeMainInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |