|
|
@@ -2,6 +2,8 @@ |
|
|
|
using System; |
|
|
|
using System.Data; |
|
|
|
using System.Collections.Generic; |
|
|
|
using Learun.Cache.Base; |
|
|
|
using Learun.Cache.Factory; |
|
|
|
|
|
|
|
namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
{ |
|
|
@@ -15,6 +17,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
public class CdDeptBLL : CdDeptIBLL |
|
|
|
{ |
|
|
|
private CdDeptService cdDeptService = new CdDeptService(); |
|
|
|
#region 缓存定义 |
|
|
|
private ICache cache = CacheFactory.CaChe(); |
|
|
|
private string cacheKey = "Learun_adms_cddept"; |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 获取数据 |
|
|
|
|
|
|
@@ -201,5 +208,70 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 扩展数据 |
|
|
|
/// <summary> |
|
|
|
/// 获取列表数据 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public List<CdDeptEntity> GetList() |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
List<CdDeptEntity> list = cache.Read<List<CdDeptEntity>>(cacheKey); |
|
|
|
if (list == null) |
|
|
|
{ |
|
|
|
list = (List<CdDeptEntity>)cdDeptService.GetList(); |
|
|
|
cache.Write<List<CdDeptEntity>>(cacheKey, list, CacheId.company); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw ExceptionEx.ThrowBusinessException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public List<TreeModel> GetTree(string parentId) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
List<CdDeptEntity> list = GetList(); |
|
|
|
List<TreeModel> treeList = new List<TreeModel>(); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |