From bfd1b73be85fd66ee37031eadcd4d09e7dafb52f Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期四, 13 二月 2025 18:51:40 +0800
Subject: [PATCH] 开始增加构件分组功能

---
 Service/HStation.Service.Assets.Core/05-service/04-FourLink/03-AssetsFourCoefficient/AssetsFourlinkCoefficient.cs |  116 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 79 insertions(+), 37 deletions(-)

diff --git a/Service/HStation.Service.Assets.Core/05-service/04-FourLink/03-AssetsFourCoefficient/AssetsFourlinkCoefficient.cs b/Service/HStation.Service.Assets.Core/05-service/04-FourLink/03-AssetsFourCoefficient/AssetsFourlinkCoefficient.cs
index 5acc1ff..63d1cc7 100644
--- a/Service/HStation.Service.Assets.Core/05-service/04-FourLink/03-AssetsFourCoefficient/AssetsFourlinkCoefficient.cs
+++ b/Service/HStation.Service.Assets.Core/05-service/04-FourLink/03-AssetsFourCoefficient/AssetsFourlinkCoefficient.cs
@@ -3,21 +3,21 @@
     /// <summary>
     ///
     /// </summary>
-    public partial class AssetsFourlinkCoefficient
+    public partial class AssetsFourlinkFactor
     {
         #region Cache
 
         //鑾峰彇缂撳瓨
-        private static List<Model.AssetsFourlinkCoefficient> GetCache()
+        private static List<Model.AssetsFourlinkFactor> GetCache()
         {
-            var all = AssetsFourlinkCoefficientCacheHelper.GetSet(() =>
+            var all = AssetsFourlinkFactorCacheHelper.GetSet(() =>
             {
-                var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+                var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
                 var entity_list = dal.GetAll();
                 var model_list = Entity2Models(entity_list);
                 if (model_list == null)
                 {
-                    model_list = new List<Model.AssetsFourlinkCoefficient>();
+                    model_list = new List<Model.AssetsFourlinkFactor>();
                 }
                 return model_list;
             }, Yw.Service.ConfigHelper.CacheKeepTime, Yw.Service.ConfigHelper.CacheRandomTime);
@@ -27,7 +27,7 @@
         //閫氳繃 ID 鏇存柊缂撳瓨
         private static void UpdateCache(long ID)
         {
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var entity_ds = dal.GetByID(ID);
             var model_ds = Entity2Model(entity_ds);
             var all = GetCache();
@@ -40,7 +40,7 @@
             {
                 model.Reset(model_ds);
             }
-            AssetsFourlinkSeriesCacheHelper.Trigger();
+            AssetsFourlinkFactorCacheHelper.Trigger();
         }
 
         //閫氳繃 Ids 鏇存柊缂撳瓨
@@ -50,7 +50,7 @@
             {
                 return;
             }
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var entity_list = dal.GetByIds(Ids);
             var model_list = Entity2Models(entity_list);
             var all = GetCache();
@@ -59,7 +59,7 @@
             {
                 all.AddRange(model_list);
             }
-            AssetsFourlinkSeriesCacheHelper.Trigger();
+            AssetsFourlinkFactorCacheHelper.Trigger();
         }
 
         //绉婚櫎缂撳瓨
@@ -67,7 +67,7 @@
         {
             var all = GetCache();
             all.RemoveAll(x => x.ID == ID);
-            AssetsFourlinkSeriesCacheHelper.Trigger();
+            AssetsFourlinkFactorCacheHelper.Trigger();
         }
 
         //绉婚櫎鎵�鏈夌紦瀛�
@@ -75,7 +75,7 @@
         {
             var all = GetCache();
             all.Clear();
-            AssetsFourlinkSeriesCacheHelper.Trigger();
+            AssetsFourlinkFactorCacheHelper.Trigger();
         }
 
         /// <summary>
@@ -83,7 +83,7 @@
         /// </summary>
         public static void PublishCache(string key)
         {
-            AssetsFourlinkSeriesCacheHelper.Publish(key);
+            AssetsFourlinkFactorCacheHelper.Publish(key);
         }
 
         #endregion Cache
@@ -93,16 +93,16 @@
         /// <summary>
         /// 鑾峰彇鎵�鏈�
         /// </summary>
-        public List<Model.AssetsFourlinkCoefficient> GetAll()
+        public List<Model.AssetsFourlinkFactor> GetAll()
         {
             var all = GetCache();
-            return all;
+            return all?.OrderBy(x => x.SortCode).ToList();
         }
 
         /// <summary>
         /// 閫氳繃 ID 鑾峰彇
         /// </summary>
-        public Model.AssetsFourlinkCoefficient GetByID(long ID)
+        public Model.AssetsFourlinkFactor GetByID(long ID)
         {
             var all = GetAll();
             return all.Find(x => x.ID == ID);
@@ -111,14 +111,27 @@
         /// <summary>
         /// 閫氳繃 ID 鑾峰彇
         /// </summary>
-        public List<Model.AssetsFourlinkCoefficient> GetByIds(List<long> Ids)
+        public List<Model.AssetsFourlinkFactor> GetByIds(List<long> Ids)
         {
             if (Ids == null || Ids.Count < 1)
             {
                 return default;
             }
             var all = GetAll();
-            return all.Where(x => Ids.Contains(x.ID)).ToList();
+            return all.Where(x => Ids.Contains(x.ID))?.OrderBy(x => x.SortCode).ToList();
+        }
+
+        /// <summary>
+        /// 鑾峰彇鏈�澶ф帓搴忕爜
+        /// </summary>
+        public int GetMaxSortCode()
+        {
+            var all = GetAll();
+            if (all == null || all.Count < 1)
+            {
+                return 0;
+            }
+            return all.Max(x => x.SortCode);
         }
 
         #endregion Query
@@ -128,13 +141,13 @@
         /// <summary>
         /// 鎻掑叆涓�鏉℃暟鎹�
         /// </summary>
-        public long Insert(Model.AssetsFourlinkCoefficient model)
+        public long Insert(Model.AssetsFourlinkFactor model)
         {
             if (model == null)
             {
                 return default;
             }
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var entity = Model2Entity(model);
             var id = dal.Insert(entity);
             if (id > 0)
@@ -147,13 +160,13 @@
         /// <summary>
         /// 鎻掑叆澶氭潯
         /// </summary>
-        public bool Inserts(List<Model.AssetsFourlinkCoefficient> list)
+        public bool Inserts(List<Model.AssetsFourlinkFactor> list)
         {
             if (list == null || list.Count < 1)
             {
                 return false;
             }
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var entity_list = Model2Entities(list);
             var ids = dal.InsertsR(entity_list);
             if (ids != null && ids.Count > 0)
@@ -171,14 +184,14 @@
         /// <summary>
         /// 鏇存柊涓�鏉�
         /// </summary>
-        public bool Update(Model.AssetsFourlinkCoefficient model)
+        public bool Update(Model.AssetsFourlinkFactor model)
         {
             if (model == null)
             {
                 return false;
             }
             var entity = Model2Entity(model);
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var bol = dal.Update(entity);
             if (bol)
             {
@@ -190,7 +203,7 @@
         /// <summary>
         /// 鎵归噺鏇存柊
         /// </summary>
-        public bool Updates(List<Model.AssetsFourlinkCoefficient> list)
+        public bool Updates(List<Model.AssetsFourlinkFactor> list)
         {
             if (list == null || list.Count < 1)
             {
@@ -201,11 +214,51 @@
                 return false;
             }
             var entity_list = Model2Entities(list);
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var bol = dal.Updates(entity_list);
             if (bol)
             {
                 UpdateCache(list.Select(x => x.ID).ToList());
+            }
+            return bol;
+        }
+
+        /// <summary>
+        /// 鏇存柊鎺掑簭鐮�
+        /// </summary>
+        public bool UpdateSortCode(long ID, int SortCode)
+        {
+            if (ID < 1)
+            {
+                return false;
+            }
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
+            var bol = dal.UpdateSortCode(ID, SortCode);
+            if (bol)
+            {
+                UpdateCache(ID);
+            }
+            return bol;
+        }
+
+        /// <summary>
+        /// 鏇存柊鎺掑簭
+        /// </summary>
+        public bool UpdateSorter(List<Yw.Model.Sorter> sorters)
+        {
+            if (sorters == null || sorters.Count < 1)
+            {
+                return false;
+            }
+            if (sorters.Exists(x => x.ID < 1))
+            {
+                return false;
+            }
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
+            var bol = dal.UpdateSorter(sorters.ToEntityList());
+            if (bol)
+            {
+                UpdateCache(sorters.Select(x => x.ID).ToList());
             }
             return bol;
         }
@@ -220,22 +273,11 @@
         public bool DeleteByID(long ID, out string Msg)
         {
             Msg = string.Empty;
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
+            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkFactor>();
             var bol = dal.DeleteByID(ID);
             if (bol)
             {
                 RemoveCache(ID);
-            }
-            return bol;
-        }
-
-        public bool DeleteAll()
-        {
-            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsFourlinkCoefficient>();
-            var bol = dal.DeleteAll();
-            if (bol)
-            {
-                RemoveAllCache();
             }
             return bol;
         }

--
Gitblit v1.9.3