| | |
| | | using HStation.Dto; |
| | | using Yw.Dto; |
| | | |
| | | namespace HStation.CAL.LocalClient |
| | | namespace HStation.CAL.LocalClient |
| | | { |
| | | /// <summary> |
| | | /// 水池系数 |
| | | ///</summary> |
| | | public class AssetsTankCoefficient : IAssetsTankCoefficient |
| | | /// 冷却塔系数 |
| | | /// </summary> |
| | | public class AssetsTankFactor : IAssetsTankFactor |
| | | { |
| | | private readonly Service.AssetsTankCoefficient _service = new(); |
| | | private readonly HStation.Service.AssetsTankFactor _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// 获取所有 |
| | | /// </summary> |
| | | public async Task<List<AssetsTankCoefficientDto>> GetAll() |
| | | public async Task<List<AssetsTankFactorDto>> GetAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vm_list = list?.Select(x => new AssetsTankCoefficientDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsTankFactorDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 通过 ID 获取 |
| | | /// </summary> |
| | | public async Task<AssetsTankCoefficientDto> GetByID(long ID) |
| | | public async Task<AssetsTankFactorDto> GetByID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | return model == null ? null : new AssetsTankCoefficientDto(model); |
| | | return model == null ? null : new AssetsTankFactorDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 Ids 获取 |
| | | /// </summary> |
| | | public async Task<List<AssetsTankCoefficientDto>> GetByIds(List<long> Ids) |
| | | public async Task<List<AssetsTankFactorDto>> GetByIds(List<long> Ids) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetByIds(Ids); |
| | | var vm_list = list?.Select(x => new AssetsTankCoefficientDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsTankFactorDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | | |
| | | #endregion Query |
| | | |
| | | |
| | | |
| | | #region Insert |
| | | |
| | | /// <summary> |
| | | /// 插入一条 |
| | | /// </summary> |
| | | public async Task<long> Insert(AddAssetsTankCoefficientInput input) |
| | | public async Task<long> Insert(AddAssetsTankFactorInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = input.Adapt<AddAssetsTankCoefficientInput, Model.AssetsTankFactor>(); |
| | | var model = input.Adapt<AddAssetsTankFactorInput, Model.AssetsTankFactor>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 批量插入 |
| | | /// </summary> |
| | | public async Task<bool> Inserts(List<AddAssetsTankCoefficientInput> inputList) |
| | | public async Task<bool> Inserts(List<AddAssetsTankFactorInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddAssetsTankCoefficientInput> list) |
| | | public async Task<bool> BulkInserts(List<AddAssetsTankFactorInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 更新一条 |
| | | /// </summary> |
| | | public async Task<bool> Update(UpdateAssetsTankCoefficientInput input) |
| | | public async Task<bool> Update(UpdateAssetsTankFactorInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 批量更新 |
| | | /// </summary> |
| | | public async Task<bool> Updates(List<UpdateAssetsTankCoefficientInput> inputList) |
| | | public async Task<bool> Updates(List<UpdateAssetsTankFactorInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 大批量更新 |
| | | /// </summary> |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsTankCoefficientInput> list) |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsTankFactorInput> list) |
| | | { |
| | | 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; |
| | | }); |
| | | } |
| | | |
| | |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var bol = _service.DeleteAll(); |
| | | return bol; |
| | | return false; |
| | | }); |
| | | } |
| | | |
| | | #endregion Delete |
| | | |
| | | } |
| | | } |