lixiaojun
2024-12-20 357693611c60d93fb17189273d4c91dab364f0d4
BLL/HStation.BLL.Assets.Core/03-localclient/21-compressor/03-factor/AssetsCompressorFactor.cs
ÎļþÃû´Ó BLL/HStation.BLL.Assets.Core/03-localclient/12-Compressor/AssetsCompressorMainAndPartMapping.cs ÐÞ¸Ä
@@ -1,25 +1,23 @@
using Yw.Dto;
namespace HStation.CAL.LocalClient
namespace HStation.CAL.LocalClient
{
    /// <summary>
    /// æŠ¥è­¦ç­‰çº§
    ///
    /// </summary>
    public class AssetsCompressorMainAndPartMapping : IAssetsCompressorMainAndPartMapping
    public class AssetsCompressorFactor : IAssetsCompressorFactor
    {
        private readonly HStation.Service.AssetsCompressorMainAndPartMapping _service = new();
        private readonly HStation.Service.AssetsCompressorFactor _service = new();
        #region Query
        /// <summary>
        /// èŽ·å–æ‰€æœ‰
        /// </summary>
        public async Task<List<AssetsCompressorMainAndPartMapDto>> GetAll()
        public async Task<List<AssetsCompressorFactorDto>> GetAll()
        {
            return await Task.Factory.StartNew(() =>
            {
                var list = _service.GetAll();
                var vm_list = list?.Select(x => new AssetsCompressorMainAndPartMapDto(x)).ToList();
                var vm_list = list?.Select(x => new AssetsCompressorFactorDto(x)).ToList();
                return vm_list;
            });
        }
@@ -27,40 +25,41 @@
        /// <summary>
        /// é€šè¿‡ ID èŽ·å–
        /// </summary>
        public async Task<AssetsCompressorMainAndPartMapDto> GetByID(long ID)
        public async Task<AssetsCompressorFactorDto> GetByID(long ID)
        {
            return await Task.Factory.StartNew(() =>
            {
                var model = _service.GetByID(ID);
                return model == null ? null : new AssetsCompressorMainAndPartMapDto(model);
                return model == null ? null : new AssetsCompressorFactorDto(model);
            });
        }
        /// <summary>
        /// é€šè¿‡ Ids èŽ·å–
        /// </summary>
        public async Task<List<AssetsCompressorMainAndPartMapDto>> GetByIds(List<long> Ids)
        public async Task<List<AssetsCompressorFactorDto>> GetByIds(List<long> Ids)
        {
            return await Task.Factory.StartNew(() =>
            {
                var list = _service.GetByIds(Ids);
                var vm_list = list?.Select(x => new AssetsCompressorMainAndPartMapDto(x)).ToList();
                var vm_list = list?.Select(x => new AssetsCompressorFactorDto(x)).ToList();
                return vm_list;
            });
        }
        #endregion Query
        #endregion
        #region Insert
        /// <summary>
        /// æ’入一条
        /// </summary>
        public async Task<long> Insert(AddAssetsCompressorMainAndPartMapInput input)
        public async Task<long> Insert(AddAssetsCompressorFactorInput input)
        {
            return await Task.Factory.StartNew(() =>
            {
                var model = input.Adapt<AddAssetsCompressorMainAndPartMapInput, Model.AssetsCompressorMainAndPartMapping>();
                var model = input.Adapt<AddAssetsCompressorFactorInput, Model.AssetsCompressorFactor>();
                model.SortCode = _service.GetMaxSortCode() + 1;
                var id = _service.Insert(model);
                return id;
            });
@@ -69,20 +68,7 @@
        /// <summary>
        /// æ‰¹é‡æ’å…¥
        /// </summary>
        public async Task<bool> Inserts(List<AddAssetsCompressorMainAndPartMapInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
                var list = inputList.Select(x => x.Adapt<AddAssetsCompressorMainAndPartMapInput, Model.AssetsCompressorMainAndPartMapping>()).ToList();
                var bol = _service.Inserts(list);
                return bol;
            });
        }
        /// <summary>
        /// å¤§æ‰¹é‡æ’å…¥
        /// </summary>
        public async Task<bool> BulkInserts(List<AddAssetsCompressorMainAndPartMapInput> list)
        public async Task<bool> Inserts(List<AddAssetsCompressorFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -90,14 +76,25 @@
            });
        }
        #endregion Insert
        /// <summary>
        /// å¤§æ‰¹é‡æ’å…¥
        /// </summary>
        public async Task<bool> BulkInserts(List<AddAssetsCompressorFactorInput> list)
        {
            return await Task.Factory.StartNew(() =>
            {
                return false;
            });
        }
        #endregion
        #region Update
        /// <summary>
        /// æ›´æ–°ä¸€æ¡
        /// </summary>
        public async Task<bool> Update(UpdateAssetsCompressorMainAndPartMapInput input)
        public async Task<bool> Update(UpdateAssetsCompressorFactorInput input)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -106,8 +103,7 @@
                {
                    throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D001, $"ID:{input.ID} æ•°æ®ä¸å­˜åœ¨");
                }
                var rhs = new Model.AssetsCompressorMainAndPartMapping(model);
                var rhs = new Model.AssetsCompressorFactor(model);
                input.Adapt(rhs);
                var bol = _service.Update(rhs);
                return bol;
@@ -117,24 +113,18 @@
        /// <summary>
        /// æ‰¹é‡æ›´æ–°
        /// </summary>
        public async Task<bool> Updates(List<UpdateAssetsCompressorMainAndPartMapInput> inputList)
        public async Task<bool> Updates(List<UpdateAssetsCompressorFactorInput> inputList)
        {
            return await Task.Factory.StartNew(() =>
            {
                if (inputList == null || inputList.Count < 1)
                {
                    return false;
                }
                var list = inputList.Select(x => x.Adapt<UpdateAssetsCompressorMainAndPartMapInput, Model.AssetsCompressorMainAndPartMapping>()).ToList();
                var bol = _service.Updates(list);
                return bol;
                return false;
            });
        }
        /// <summary>
        /// å¤§æ‰¹é‡æ›´æ–°
        /// </summary>
        public async Task<bool> BulkUpdates(List<UpdateAssetsCompressorMainAndPartMapInput> list)
        public async Task<bool> BulkUpdates(List<UpdateAssetsCompressorFactorInput> list)
        {
            return await Task.Factory.StartNew(() =>
            {
@@ -143,17 +133,31 @@
        }
        /// <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;
            });
        }
        #endregion Update
        /// <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;
            });
        }
        #endregion
        #region Delete
@@ -196,6 +200,8 @@
            });
        }
        #endregion Delete
        #endregion
    }
}