| | |
| | | { |
| | | public class Sys_DictionaryRepository : RepositoryBase<Sys_Dictionary>, ISys_DictionaryRepository |
| | | { |
| | | |
| | | |
| | | public Sys_DictionaryRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public IEnumerable<Sys_Dictionary> GetDictionaries(IEnumerable<string> dicNos, bool executeSql = true) |
| | | { |
| | | List<Sys_Dictionary> Dictionaries = GetAllDictionary(); |
| | | List<Sys_Dictionary> Dictionaries = GetDictionaries(dicNos.ToList()); |
| | | |
| | | foreach (var item in Dictionaries.Where(x => dicNos.Contains(x.DicNo))) |
| | | foreach (var item in Dictionaries) |
| | | { |
| | | if (executeSql) |
| | | { |
| | | // 2020.05.01澧炲姞鏍规嵁鐢ㄦ埛淇℃伅鍔犺浇瀛楀吀鏁版嵁婧恠ql |
| | | string sql = item.DBSql; |
| | | string sql = item.Sql; |
| | | if (!string.IsNullOrEmpty(sql)) |
| | | { |
| | | item.DicList = Query(sql); |
| | |
| | | { |
| | | return base.QueryDynamicDataBySql(sql, null).Select(s => new Sys_DictionaryList() |
| | | { |
| | | DicName = s.Value, |
| | | DicValue = s.Key.ToString() |
| | | DicName = s.value, |
| | | DicValue = s.key.ToString() |
| | | }).ToList(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | private List<Sys_Dictionary> GetDictionaries(List<string> dicNos) |
| | | { |
| | | //base.QueryData().ToList(); |
| | | List<Sys_Dictionary> _dictionaries = Db.Queryable<Sys_Dictionary>().Where(x => x.Enable == 1 && dicNos.Contains(x.DicNo)).Includes(x => x.DicList).ToList(); |
| | | return _dictionaries; |
| | | } |
| | | |
| | | private List<Sys_Dictionary> GetAllDictionary() |
| | | { |
| | | //base.QueryData().ToList(); |