lixiaojun
2025-02-06 146ca8c7eefe74d3b73c00a73e99e94e903be401
BLL/HStation.BLL.Assets.Core/03-localclient/18-Hydrant/AssetsHydrantCoefficient.cs
@@ -1,26 +1,23 @@
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;
            });
        }
@@ -28,40 +25,43 @@
        /// <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;
            });
@@ -70,7 +70,7 @@
        /// <summary>
        /// 批量插入
        /// </summary>
        public async Task<bool> Inserts(List<AddAssetsHydrantCoefficientInput> inputList)
        public async Task<bool> Inserts(List<AddAssetsHydrantFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -81,7 +81,7 @@
        /// <summary>
        /// 大批量插入
        /// </summary>
        public async Task<bool> BulkInserts(List<AddAssetsHydrantCoefficientInput> list)
        public async Task<bool> BulkInserts(List<AddAssetsHydrantFactorInput> list)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -96,7 +96,7 @@
        /// <summary>
        /// 更新一条
        /// </summary>
        public async Task<bool> Update(UpdateAssetsHydrantCoefficientInput input)
        public async Task<bool> Update(UpdateAssetsHydrantFactorInput input)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -105,7 +105,7 @@
                {
                    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;
@@ -115,7 +115,7 @@
        /// <summary>
        /// 批量更新
        /// </summary>
        public async Task<bool> Updates(List<UpdateAssetsHydrantCoefficientInput> inputList)
        public async Task<bool> Updates(List<UpdateAssetsHydrantFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -126,11 +126,36 @@
        /// <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;
            });
        }
@@ -166,8 +191,9 @@
        }
        /// <summary>
        /// 全部删除
        /// 删除全部
        /// </summary>
        /// <returns></returns>
        public async Task<bool> DeleteAll()
        {
            return await Task.Factory.StartNew(() =>
@@ -177,5 +203,6 @@
        }
        #endregion Delete
    }
}