From 313c5cbe5c63fa07f78fa24d8cc33b75435a266f Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期四, 07 八月 2025 17:00:40 +0800
Subject: [PATCH] feat:字典优化

---
 FlexJobApi.Application/Dictionaries/Commands/DictionaryDataCommandHandler.cs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/FlexJobApi.Application/Dictionaries/Commands/DictionaryDataCommandHandler.cs b/FlexJobApi.Application/Dictionaries/Commands/DictionaryDataCommandHandler.cs
index ac2f0cf..6e121f5 100644
--- a/FlexJobApi.Application/Dictionaries/Commands/DictionaryDataCommandHandler.cs
+++ b/FlexJobApi.Application/Dictionaries/Commands/DictionaryDataCommandHandler.cs
@@ -83,6 +83,12 @@
             return request.SetIsDisabled<DictionaryData>(cancellationToken: cancellationToken);
         }
 
+        /// <summary>
+        /// 鍚屾浜哄姏璧勬簮鍦板尯瀛楀吀鏁版嵁
+        /// </summary>
+        /// <param name="request"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
         public async Task<int> Handle(SyncHumanResourcesAreaDictionaryDataCommand request, CancellationToken cancellationToken)
         {
             var repHumanResourcesBaseArea = Db.GetRepository<BaseArea, HumanResourcesDbContextLocator>();
@@ -96,12 +102,19 @@
                 CategoryId = categoryId
             });
             var parentAreas = areas.Where(it => it.ParentId == 0).ToList();
-            LoopAdd(categoryId, entities, areas, parentAreas);
+            LoopSyncHumanResourcesAreaDictionaryData(categoryId, entities, areas, parentAreas);
             await rep.Context.BulkInsertAsync(entities);
             return entities.Count;
         }
 
-        public void LoopAdd(Guid categoryId, List<DictionaryData> entities, List<BaseArea> all, List<BaseArea> areas)
+        /// <summary>
+        /// 閫掑綊鍚屾浜哄姏璧勬簮鍦板尯瀛楀吀鏁版嵁
+        /// </summary>
+        /// <param name="categoryId"></param>
+        /// <param name="entities"></param>
+        /// <param name="all"></param>
+        /// <param name="areas"></param>
+        private void LoopSyncHumanResourcesAreaDictionaryData(Guid categoryId, List<DictionaryData> entities, List<BaseArea> all, List<BaseArea> areas)
         {
             if (areas.IsNotNull())
             {
@@ -140,7 +153,7 @@
                     entities.Add(entity);
 
                     var children = all.Where(it => it.ParentId == area.AreaCode).ToList();
-                    LoopAdd(categoryId, entities, all, children);
+                    LoopSyncHumanResourcesAreaDictionaryData(categoryId, entities, all, children);
                 }
             }
         }

--
Gitblit v1.9.1