From 9eeca6aa905cffea1c95d965b4790fbd20ce2275 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期五, 25 十月 2024 16:19:16 +0800
Subject: [PATCH] 更新字典数据获取

---
 WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs b/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
index ee6f4d9..e04fe7a 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
@@ -54,13 +54,32 @@
             }
             if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0)
             {
-                List<VueDictionaryDTO> selectDics = BaseDal.GetDictionaries(dicNos.Where(x => !cacheDicNos.Contains(x))).Select(s => new VueDictionaryDTO
+                List<string> list = dicNos.Where(x => !cacheDicNos.Contains(x)).ToList();
+                List<Sys_Dictionary> dictionaries = BaseDal.GetDictionaries(list).ToList();
+
+                List<VueDictionaryDTO> selectDics = dictionaries.Select(s => new VueDictionaryDTO
                 {
                     DicNo = s.DicNo,
                     Config = s.Config,
                     //dbSql = s.Sql,
                     Data = s.DicList.OrderByDescending(o => o.OrderNo).Select(list => new { key = list.DicValue, value = list.DicName })
                 }).ToList();
+
+                foreach (var v in dictionaries)
+                {
+                    if (!string.IsNullOrEmpty(v.DBSql))
+                    {
+                        VueDictionaryDTO? temp = selectDics.FirstOrDefault(x => x.DicNo == v.DicNo);
+                        if (temp != null)
+                            selectDics.Remove(temp);
+                        selectDics.Add(new VueDictionaryDTO
+                        {
+                            Config = v.Config,
+                            DicNo = v.DicNo,
+                            Data = BaseDal.QueryDynamicDataBySql(v.DBSql)
+                        });
+                    }
+                }
 
                 foreach (var item in selectDics)
                 {
@@ -87,10 +106,10 @@
             //    Data = GetSourceData(item.dicNo, item.dbSql, item.list)
             //}).ToList();
 
-            
+
             return vueDictionaryDTOs;
         }
 
-        
+
     }
 }

--
Gitblit v1.9.3