From cc24ed41e7c9e64cd8e4ace4828ed59618894e72 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Mon, 17 Oct 2022 16:49:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E5=AD=97=E5=85=B8=EF=BC=9A=E6=98=BE=E7=A4=BA=E6=97=A0?= =?UTF-8?q?=E6=95=88=E9=A1=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DataItemController.cs | 13 +++ .../LR_SystemModule/Views/DataItem/Index.js | 2 +- .../SystemModule/DataItem/DataItemBLL.cs | 90 +++++++++++++++---- .../SystemModule/DataItem/DataItemIBLL.cs | 7 ++ .../SystemModule/DataItem/DataItemService.cs | 28 ++++++ 5 files changed, 124 insertions(+), 16 deletions(-) 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 {