| | |
| | | using HStation.Dto; |
| | | using Yw.Dto; |
| | | |
| | | namespace HStation.CAL.LocalClient |
| | | namespace HStation.CAL.LocalClient |
| | | { |
| | | /// <summary> |
| | | /// 消火栓系数 |
| | | ///</summary> |
| | | public class AssetsHydrantCoefficient : IAssetsHydrantCoefficient |
| | | /// 换热器系数 |
| | | /// </summary> |
| | | public class AssetsHydrantFactor : IAssetsHydrantFactor |
| | | { |
| | | private readonly Service.AssetsHydrantCoefficient _service = new(); |
| | | private readonly HStation.Service.AssetsHydrantFactor _service = new(); |
| | | |
| | | #region Query |
| | | |
| | | /// <summary> |
| | | /// 获取所有 |
| | | /// </summary> |
| | | public async Task<List<AssetsHydrantCoefficientDto>> GetAll() |
| | | public async Task<List<AssetsHydrantFactorDto>> GetAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetAll(); |
| | | var vm_list = list?.Select(x => new AssetsHydrantCoefficientDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsHydrantFactorDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 通过 ID 获取 |
| | | /// </summary> |
| | | public async Task<AssetsHydrantCoefficientDto> GetByID(long ID) |
| | | public async Task<AssetsHydrantFactorDto> GetByID(long ID) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = _service.GetByID(ID); |
| | | return model == null ? null : new AssetsHydrantCoefficientDto(model); |
| | | return model == null ? null : new AssetsHydrantFactorDto(model); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过 Ids 获取 |
| | | /// </summary> |
| | | public async Task<List<AssetsHydrantCoefficientDto>> GetByIds(List<long> Ids) |
| | | public async Task<List<AssetsHydrantFactorDto>> GetByIds(List<long> Ids) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var list = _service.GetByIds(Ids); |
| | | var vm_list = list?.Select(x => new AssetsHydrantCoefficientDto(x)).ToList(); |
| | | var vm_list = list?.Select(x => new AssetsHydrantFactorDto(x)).ToList(); |
| | | return vm_list; |
| | | }); |
| | | } |
| | | |
| | | #endregion Query |
| | | |
| | | |
| | | |
| | | #region Insert |
| | | |
| | | /// <summary> |
| | | /// 插入一条 |
| | | /// </summary> |
| | | public async Task<long> Insert(AddAssetsHydrantCoefficientInput input) |
| | | public async Task<long> Insert(AddAssetsHydrantFactorInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | | var model = input.Adapt<AddAssetsHydrantCoefficientInput, Model.AssetsHydrantCoefficient>(); |
| | | var model = input.Adapt<AddAssetsHydrantFactorInput, Model.AssetsHydrantFactor>(); |
| | | model.SortCode = _service.GetMaxSortCode() + 1; |
| | | var id = _service.Insert(model); |
| | | return id; |
| | | }); |
| | |
| | | /// <summary> |
| | | /// 批量插入 |
| | | /// </summary> |
| | | public async Task<bool> Inserts(List<AddAssetsHydrantCoefficientInput> inputList) |
| | | public async Task<bool> Inserts(List<AddAssetsHydrantFactorInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts(List<AddAssetsHydrantCoefficientInput> list) |
| | | public async Task<bool> BulkInserts(List<AddAssetsHydrantFactorInput> list) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 更新一条 |
| | | /// </summary> |
| | | public async Task<bool> Update(UpdateAssetsHydrantCoefficientInput input) |
| | | public async Task<bool> Update(UpdateAssetsHydrantFactorInput input) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} 数据不存在"); |
| | | } |
| | | var rhs = new Model.AssetsHydrantCoefficient(model); |
| | | var rhs = new Model.AssetsHydrantFactor(model); |
| | | input.Adapt(rhs); |
| | | var bol = _service.Update(rhs); |
| | | return bol; |
| | |
| | | /// <summary> |
| | | /// 批量更新 |
| | | /// </summary> |
| | | public async Task<bool> Updates(List<UpdateAssetsHydrantCoefficientInput> inputList) |
| | | public async Task<bool> Updates(List<UpdateAssetsHydrantFactorInput> inputList) |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | | { |
| | |
| | | /// <summary> |
| | | /// 大批量更新 |
| | | /// </summary> |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsHydrantCoefficientInput> list) |
| | | public async Task<bool> BulkUpdates(List<UpdateAssetsHydrantFactorInput> 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; |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 全部删除 |
| | | /// 删除全部 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<bool> DeleteAll() |
| | | { |
| | | return await Task.Factory.StartNew(() => |
| | |
| | | } |
| | | |
| | | #endregion Delete |
| | | |
| | | } |
| | | } |