Parcourir la source

专业开课计划左侧树报错

临城职教中职
ndbs il y a 2 ans
Parent
révision
e39c42f67b
4 fichiers modifiés avec 129 ajouts et 0 suppressions
  1. +13
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/CdDeptController.cs
  2. +72
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptBLL.cs
  3. +15
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptIBLL.cs
  4. +29
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptService.cs

+ 13
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/CdDeptController.cs Voir le fichier

@@ -94,6 +94,19 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
return Success(data);
}

/// <summary>
/// 获取树形数据
/// </summary>
/// <param name="parentId">父级id</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetTree(string parentId)
{
var data = cdDeptIBLL.GetTree(parentId);
return JsonResult(data);
}

#endregion

#region 提交数据


+ 72
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptBLL.cs Voir le fichier

@@ -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
}
}

+ 15
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptIBLL.cs Voir le fichier

@@ -55,5 +55,20 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration

IEnumerable<CdDeptEntity> GetListBySchoolId(string schoolId);
IEnumerable<CdDeptEntity> GetAllList();

#region 扩展数据
/// <summary>
/// 获取树形数据
/// </summary>
/// <param name="parentId">父级id</param>
/// <returns></returns>
List<TreeModel> GetTree(string parentId);

/// <summary>
/// 获取列表数据
/// </summary>
/// <returns></returns>
List<CdDeptEntity> GetList();
#endregion
}
}

+ 29
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/CdDept/CdDeptService.cs Voir le fichier

@@ -250,5 +250,34 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

#region 扩展数据
/// <summary>
/// 获取公司列表信息(全部)
/// </summary>
/// <returns></returns>
public IEnumerable<CdDeptEntity> 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<CdDeptEntity>(strSql.ToString());
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
}
}

Chargement…
Annuler
Enregistrer