diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/DataItemController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/DataItemController.cs index 9ee6b61a1..de0fe52d1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/DataItemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/DataItemController.cs @@ -160,6 +160,19 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers return JsonResult(data); } /// + /// 获取数据字典明显根据分类编号 + /// + /// 分类编号 + /// 查询条件 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetDetailList2(string itemCode, string keyword) + { + var data = dataItemIBLL.GetDetailList2(itemCode, keyword); + return JsonResult(data); + } + /// /// 获取数据字典明显树形数据 /// /// 分类编号 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/DataItem/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/DataItem/Index.js index 6da6953f8..d8a33ddbe 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/DataItem/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/DataItem/Index.js @@ -106,7 +106,7 @@ var bootstrap = function ($, learun) { }, initGrid: function () { $('#gridtable').jfGrid({ - url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList', + url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList2', headData: [ { label: '标准编码', name: 'F_ItemCodeGB', width: 200, align: 'left' diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs index ee81424af..f4293a4d1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemBLL.cs @@ -131,7 +131,8 @@ namespace Learun.Application.Base.SystemModule /// 主键 /// 编码 /// - public bool ExistItemCode(string keyValue, string itemCode) { + public bool ExistItemCode(string keyValue, string itemCode) + { try { bool res = false; @@ -199,7 +200,8 @@ namespace Learun.Application.Base.SystemModule /// /// 主键 /// 实体 - public void SaveClassifyEntity(string keyValue, DataItemEntity entity) { + public void SaveClassifyEntity(string keyValue, DataItemEntity entity) + { try { dataItemService.SaveClassifyEntity(keyValue, entity); @@ -279,7 +281,7 @@ namespace Learun.Application.Base.SystemModule try { List list = cache.Read>(cacheKeyDetail + itemCode, CacheId.dataItem); - if (list?.Count==0 || list==null) + if (list?.Count == 0 || list == null) { list = (List)dataItemService.GetDetailList(itemCode); cache.Write>(cacheKeyDetail + itemCode, list, CacheId.dataItem); @@ -298,12 +300,35 @@ namespace Learun.Application.Base.SystemModule } } } - + /// + /// 获取数据字典明显 + /// + /// 分类编码 + /// + public List GetDetailList2(string itemCode) + { + try + { + List list = (List)dataItemService.GetDetailList2(itemCode); + return list; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } public IEnumerable GetAllDetailList() { try { - return dataItemService.GetAllDetailList(); + return dataItemService.GetAllDetailList(); } catch (Exception ex) { @@ -322,20 +347,24 @@ namespace Learun.Application.Base.SystemModule /// 获取数据字典详细映射数据 /// /// - public Dictionary> GetModelMap() + public Dictionary> GetModelMap() { try { - Dictionary> dic = cache.Read>>(cacheKeyDetail + "dic", CacheId.dataItem); - if (dic == null) { - dic = new Dictionary>(); + Dictionary> dic = cache.Read>>(cacheKeyDetail + "dic", CacheId.dataItem); + if (dic == null) + { + dic = new Dictionary>(); var list = GetClassifyList(); - foreach (var item in list) { + foreach (var item in list) + { var detailList = GetDetailList(item.F_ItemCode); - if (!dic.ContainsKey(item.F_ItemCode)) { - dic.Add(item.F_ItemCode,new Dictionary()); + if (!dic.ContainsKey(item.F_ItemCode)) + { + dic.Add(item.F_ItemCode, new Dictionary()); } - foreach (var detailItem in detailList) { + foreach (var detailItem in detailList) + { dic[item.F_ItemCode].Add(detailItem.F_ItemDetailId, new DataItemModel() { parentId = detailItem.F_ParentId, @@ -373,7 +402,37 @@ namespace Learun.Application.Base.SystemModule try { List list = GetDetailList(itemCode); - if (!string.IsNullOrEmpty(keyword)) { + if (!string.IsNullOrEmpty(keyword)) + { + list = list.FindAll(t => t.F_ItemName.Contains(keyword) || t.F_ItemValue.Contains(keyword)); + } + return list; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 获取数据字典明显 + /// + /// 分类编码 + /// 关键词(名称/值) + /// + public List GetDetailList2(string itemCode, string keyword) + { + try + { + List list = GetDetailList2(itemCode); + if (!string.IsNullOrEmpty(keyword)) + { list = list.FindAll(t => t.F_ItemName.Contains(keyword) || t.F_ItemValue.Contains(keyword)); } return list; @@ -435,7 +494,8 @@ namespace Learun.Application.Base.SystemModule { List list = GetDetailList(itemCode); List treeList = new List(); - foreach (var item in list) { + foreach (var item in list) + { TreeModel node = new TreeModel(); node.id = item.F_ItemDetailId; node.text = item.F_ItemName; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs index 48d312cfc..a6255d2a7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemIBLL.cs @@ -78,6 +78,13 @@ namespace Learun.Application.Base.SystemModule /// 关键词(名称/值) /// List GetDetailList(string itemCode, string keyword); + /// + /// 获取数据字典明显 + /// + /// 分类编码 + /// 关键词(名称/值) + /// + List GetDetailList2(string itemCode, string keyword); /// /// 获取数据字典详细映射数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs index 2573255e1..2f965041b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/DataItem/DataItemService.cs @@ -187,6 +187,34 @@ namespace Learun.Application.Base.SystemModule /// 分类编号 /// public IEnumerable GetDetailList(string itemCode) + { + try + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("SELECT " + detailFieldSql + @" FROM LR_Base_DataItemDetail t + INNER JOIN LR_Base_DataItem t2 ON t.F_ItemId = t2.F_ItemId + WHERE t2.F_ItemCode = @itemCode AND t.F_DeleteMark = 0 and t.F_EnabledMark=1 Order By t.F_SortCode + "); + return this.BaseRepository().FindList(strSql.ToString(), new { itemCode = itemCode }); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// + /// 获取数据字典明显根据分类编号 + /// + /// 分类编号 + /// + public IEnumerable GetDetailList2(string itemCode) { try {