duheng
2024-12-24 0e33247236d4ac46f1a75802f53dd6c612301cff
BLL/HStation.BLL.Assets.Core/03-localclient/08-FourLink/AssetsFourlinkFactor.cs
ÎļþÃû´Ó BLL/HStation.BLL.Assets.Core/03-localclient/08-FourLink/AssetsFourlinkCoefficient.cs ÐÞ¸Ä
@@ -1,26 +1,23 @@
using HStation.Dto;
using Yw.Dto;
namespace HStation.CAL.LocalClient
namespace HStation.CAL.LocalClient
{
    /// <summary>
    /// æŠ¥è­¦ç­‰çº§
    /// æ¢çƒ­å™¨ç³»æ•°
    /// </summary>
    public class AssetsFourlinkCoefficient : IAssetsFourlinkCoefficient
    public class AssetsFourlinkFactor : IAssetsFourlinkFactor
    {
        private readonly HStation.Service.AssetsFourlinkCoefficient _service = new();
        private readonly HStation.Service.AssetsFourlinkFactor _service = new();
        #region Query
        /// <summary>
        /// èŽ·å–æ‰€æœ‰
        /// </summary>
        public async Task<List<AssetsFourlinkCoefficientDto>> GetAll()
        public async Task<List<AssetsFourlinkFactorDto>> GetAll()
        {
            return await Task.Factory.StartNew(() =>
            {
                var list = _service.GetAll();
                var vm_list = list?.Select(x => new AssetsFourlinkCoefficientDto(x)).ToList();
                var vm_list = list?.Select(x => new AssetsFourlinkFactorDto(x)).ToList();
                return vm_list;
            });
        }
@@ -28,40 +25,43 @@
        /// <summary>
        /// é€šè¿‡ ID èŽ·å–
        /// </summary>
        public async Task<AssetsFourlinkCoefficientDto> GetByID(long ID)
        public async Task<AssetsFourlinkFactorDto> GetByID(long ID)
        {
            return await Task.Factory.StartNew(() =>
            {
                var model = _service.GetByID(ID);
                return model == null ? null : new AssetsFourlinkCoefficientDto(model);
                return model == null ? null : new AssetsFourlinkFactorDto(model);
            });
        }
        /// <summary>
        /// é€šè¿‡ Ids èŽ·å–
        /// </summary>
        public async Task<List<AssetsFourlinkCoefficientDto>> GetByIds(List<long> Ids)
        public async Task<List<AssetsFourlinkFactorDto>> GetByIds(List<long> Ids)
        {
            return await Task.Factory.StartNew(() =>
            {
                var list = _service.GetByIds(Ids);
                var vm_list = list?.Select(x => new AssetsFourlinkCoefficientDto(x)).ToList();
                var vm_list = list?.Select(x => new AssetsFourlinkFactorDto(x)).ToList();
                return vm_list;
            });
        }
        #endregion Query
        #region Insert
        /// <summary>
        /// æ’入一条
        /// </summary>
        public async Task<long> Insert(AddAssetsFourlinkCoefficientInput input)
        public async Task<long> Insert(AddAssetsFourlinkFactorInput input)
        {
            return await Task.Factory.StartNew(() =>
            {
                var model = input.Adapt<AddAssetsFourlinkCoefficientInput, Model.AssetsFourlinkCoefficient>();
                var model = input.Adapt<AddAssetsFourlinkFactorInput, Model.AssetsFourlinkFactor>();
                model.SortCode = _service.GetMaxSortCode() + 1;
                var id = _service.Insert(model);
                return id;
            });
@@ -70,20 +70,7 @@
        /// <summary>
        /// æ‰¹é‡æ’å…¥
        /// </summary>
        public async Task<bool> Inserts(List<AddAssetsFourlinkCoefficientInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
                var list = inputList.Select(x => x.Adapt<AddAssetsFourlinkCoefficientInput, Model.AssetsFourlinkCoefficient>()).ToList();
                var bol = _service.Inserts(list);
                return bol;
            });
        }
        /// <summary>
        /// å¤§æ‰¹é‡æ’å…¥
        /// </summary>
        public async Task<bool> BulkInserts(List<AddAssetsFourlinkCoefficientInput> list)
        public async Task<bool> Inserts(List<AddAssetsFourlinkFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -91,22 +78,16 @@
            });
        }
        /*       /// <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> BulkInserts(List<AddAssetsFourlinkFactorInput> list)
        {
            return await Task.Factory.StartNew(() =>
            {
                return false;
            });
        }
        #endregion Insert
@@ -115,7 +96,7 @@
        /// <summary>
        /// æ›´æ–°ä¸€æ¡
        /// </summary>
        public async Task<bool> Update(UpdateAssetsFourlinkCoefficientInput input)
        public async Task<bool> Update(UpdateAssetsFourlinkFactorInput input)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -124,8 +105,7 @@
                {
                    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} æ•°æ®ä¸å­˜åœ¨");
                }
                var rhs = new Model.AssetsFourlinkCoefficient(model);
                var rhs = new Model.AssetsFourlinkFactor(model);
                input.Adapt(rhs);
                var bol = _service.Update(rhs);
                return bol;
@@ -135,24 +115,18 @@
        /// <summary>
        /// æ‰¹é‡æ›´æ–°
        /// </summary>
        public async Task<bool> Updates(List<UpdateAssetsFourlinkCoefficientInput> inputList)
        public async Task<bool> Updates(List<UpdateAssetsFourlinkFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
                if (inputList == null || inputList.Count < 1)
                {
                    return false;
                }
                var list = inputList.Select(x => x.Adapt<UpdateAssetsFourlinkCoefficientInput, Model.AssetsFourlinkCoefficient>()).ToList();
                var bol = _service.Updates(list);
                return bol;
                return false;
            });
        }
        /// <summary>
        /// å¤§æ‰¹é‡æ›´æ–°
        /// </summary>
        public async Task<bool> BulkUpdates(List<UpdateAssetsFourlinkCoefficientInput> list)
        public async Task<bool> BulkUpdates(List<UpdateAssetsFourlinkFactorInput> list)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -161,13 +135,27 @@
        }
        /// <summary>
        /// æ›´æ–°ç¼–码
        /// æ›´æ–°æŽ’序码
        /// </summary>
        public async Task<bool> UpdateCode(long ID, string Code)
        public async Task<bool> UpdateSortCode(long ID, int SortCode)
        {
            return await Task.Factory.StartNew(() =>
            {
                return false;
                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;
            });
        }
@@ -210,11 +198,11 @@
        {
            return await Task.Factory.StartNew(() =>
            {
                var bol = _service.DeleteAll();
                return bol;
                return false;
            });
        }
        #endregion Delete
    }
}