duheng
2024-12-20 f1fac249aec3a5390152fa2a9a13e8da98283c3b
BLL/HStation.BLL.Assets.Core/03-localclient/15-Tank/AssetsTankCoefficient.cs
@@ -1,26 +1,23 @@
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;
            });
        }
@@ -28,40 +25,43 @@
        /// <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;
            });
@@ -70,7 +70,7 @@
        /// <summary>
        /// 批量插入
        /// </summary>
        public async Task<bool> Inserts(List<AddAssetsTankCoefficientInput> inputList)
        public async Task<bool> Inserts(List<AddAssetsTankFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -81,7 +81,7 @@
        /// <summary>
        /// 大批量插入
        /// </summary>
        public async Task<bool> BulkInserts(List<AddAssetsTankCoefficientInput> list)
        public async Task<bool> BulkInserts(List<AddAssetsTankFactorInput> list)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -96,7 +96,7 @@
        /// <summary>
        /// 更新一条
        /// </summary>
        public async Task<bool> Update(UpdateAssetsTankCoefficientInput input)
        public async Task<bool> Update(UpdateAssetsTankFactorInput input)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -115,7 +115,7 @@
        /// <summary>
        /// 批量更新
        /// </summary>
        public async Task<bool> Updates(List<UpdateAssetsTankCoefficientInput> inputList)
        public async Task<bool> Updates(List<UpdateAssetsTankFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -126,11 +126,36 @@
        /// <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;
            });
        }
@@ -173,11 +198,11 @@
        {
            return await Task.Factory.StartNew(() =>
            {
                var bol = _service.DeleteAll();
                return bol;
                return false;
            });
        }
        #endregion Delete
    }
}