From 1618dc05ba25286d0643f1a946b60cee6987f014 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 14 十月 2024 15:32:52 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_Services/Sys_DictionaryService.cs |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Services/Sys_DictionaryService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Services/Sys_DictionaryService.cs"
new file mode 100644
index 0000000..621a3ec
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Services/Sys_DictionaryService.cs"
@@ -0,0 +1,50 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_IRepository;
+using WIDESEA_IServices;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_Services
+{
+    public class Sys_DictionaryService : ServiceBase<Sys_Dictionary, ISys_DictionaryRepository>, ISys_DictionaryService
+    {
+        private readonly IUnitOfWorkManage _unitOfWorkManage;
+        public Sys_DictionaryService(ISys_DictionaryRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+        {
+            _unitOfWorkManage = unitOfWorkManage;
+        }
+
+        public object GetVueDictionary(string[] dicNos)
+        {
+            if (dicNos == null || dicNos.Count() == 0) return new string[] { };
+
+            var dicConfig = BaseDal.GetDictionaries(dicNos, false).Select(s => new
+            {
+                dicNo = s.DicNo,
+                config = s.Config,
+                dbSql = s.DBSql,
+                list = s.DicList.OrderByDescending(o => o.OrderNo).Select(list => new { key = list.DicValue, value = list.DicName })
+            }).ToList();
+
+            object GetSourceData(string dicNo, string dbSql, object data)
+            {
+                if (string.IsNullOrEmpty(dbSql))
+                {
+                    return data as object;
+                }
+                return BaseDal.QueryObjectDataBySql(dbSql, null);
+            }
+            return dicConfig.Select(item => new
+            {
+                item.dicNo,
+                item.config,
+                data = GetSourceData(item.dicNo, item.dbSql, item.list)
+            }).ToList();
+        }
+    }
+}

--
Gitblit v1.9.3