| using 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(); | 
|         } | 
|     } | 
| } |