From 4f2b6b7cf20aff342f8cfbecc7c49d844702a9db Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 9 Aug 2022 10:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E4=B8=9A=E5=BC=80=E8=AF=BE=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=B7=A6=E4=BE=A7=E6=A0=91=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CdDeptController.cs | 13 +++- .../CdDept/CdDeptBLL.cs | 62 +++++++++++++++++++ .../CdDept/CdDeptIBLL.cs | 6 ++ .../CdDept/CdDeptService.cs | 26 ++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/CdDeptController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/CdDeptController.cs index 9e6e7d06c..b7875fbfd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/CdDeptController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/CdDeptController.cs @@ -42,7 +42,18 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers #endregion #region 获取数据 - + /// + /// 获取树形数据 + /// + /// 父级id + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetTree(string parentId) + { + var data = cdDeptIBLL.GetTree(parentId); + return JsonResult(data); + } /// /// 获取页面显示列表数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptBLL.cs index 761e51319..7f1f837a3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptBLL.cs @@ -20,6 +20,68 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration #region 获取数据 + public List GetTree(string parentId) + { + try + { + List list = GetList(); + List treeList = new List(); + foreach (var item in list) + { + TreeModel node = new TreeModel + { + id = item.DeptNo, + text = item.DeptName, + value = item.DeptNo, + showcheck = false, + checkstate = 0, + isexpand = true, + parentId = item.DeptId + }; + treeList.Add(node); + } + return treeList.ToTree(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 获取列表数据 + /// + /// + public List GetList() + { + try + { + //List list = cache.Read>(cacheKey); + //if (list == null) + //{ + // list = (List)cdDeptService.GetList(); + // cache.Write>(cacheKey, list, CacheId.company); + //} + return list; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 获取页面显示列表数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptIBLL.cs index f78a44803..065acaa4a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptIBLL.cs @@ -15,6 +15,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { #region 获取数据 + /// + /// 获取树形数据 + /// + /// 父级id + /// + List GetTree(string parentId); /// /// 获取页面显示列表数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptService.cs index dc46d1853..e32b67cd3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptService.cs @@ -20,6 +20,32 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { #region 获取数据 + /// + /// 获取公司列表信息(全部) + /// + /// + public IEnumerable GetList() + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(" * "); + strSql.Append(" FROM CdDept t WHERE 1=1 order by t.deptSort "); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } /// /// 获取页面显示列表数据 ///