Commit 785f0ab5 authored by 吴春's avatar 吴春

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents f228d1c4 72e89725
...@@ -145,14 +145,26 @@ namespace Edu.Module.User ...@@ -145,14 +145,26 @@ namespace Edu.Module.User
{ {
deptList = new List<RB_Department_ViewModel>(); deptList = new List<RB_Department_ViewModel>();
} }
if(isQueryEmployee) if (isQueryEmployee)
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel()
{ {
empList= accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { Group_Id = query.Group_Id }); Group_Id = query.Group_Id,
School_Id = query.School_Id
});
} }
if (deptList != null && deptList.Count > 0) if (deptList != null && deptList.Count > 0)
{ {
var firstList = deptList.Where(qitem => qitem.ParentId == 0 && qitem.School_Id==0).ToList(); var firstList = new List<RB_Department_ViewModel>();
if (query.School_Id == 0)
{
firstList = deptList.Where(qitem => qitem.ParentId == 0 && qitem.School_Id == 0).ToList();
}
else
{
var minParentId = deptList.Where(qitem => qitem.School_Id == query.School_Id).Min(qitem => qitem.ParentId);
firstList = deptList.Where(qitem => qitem.ParentId == minParentId && qitem.School_Id == query.School_Id).ToList();
}
if (firstList != null && firstList.Count > 0) if (firstList != null && firstList.Count > 0)
{ {
foreach (var fItem in firstList) foreach (var fItem in firstList)
...@@ -181,7 +193,7 @@ namespace Edu.Module.User ...@@ -181,7 +193,7 @@ namespace Edu.Module.User
DeptName = eItem.EmployeeName, DeptName = eItem.EmployeeName,
ParentId = 0, ParentId = 0,
ChildList = new List<DepartmentTree_ViewModel>(), ChildList = new List<DepartmentTree_ViewModel>(),
School_Id=eItem.School_Id School_Id = eItem.School_Id
}); });
} }
} }
...@@ -192,6 +204,7 @@ namespace Edu.Module.User ...@@ -192,6 +204,7 @@ namespace Edu.Module.User
list.Add(tModel); list.Add(tModel);
} }
} }
} }
return list; return list;
} }
......
...@@ -897,8 +897,11 @@ namespace Edu.WebApi.Controllers.User ...@@ -897,8 +897,11 @@ namespace Edu.WebApi.Controllers.User
[HttpPost] [HttpPost]
public ApiResult GetDeptTree() public ApiResult GetDeptTree()
{ {
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Department_ViewModel>(RequestParm.Msg.ToString()); var query = new RB_Department_ViewModel()
query.Group_Id = base.UserInfo.Group_Id; {
Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id")
};
var list = departmentModule.GetDepartmentTreeModule(query); var list = departmentModule.GetDepartmentTreeModule(query);
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment