Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
681fb74b
Commit
681fb74b
authored
Dec 07, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
baa931a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
8 deletions
+84
-8
DepartmentTree_ViewModel.cs
Edu.Model/ViewModel/User/DepartmentTree_ViewModel.cs
+1
-1
DepartmentModule.cs
Edu.Module.User/DepartmentModule.cs
+67
-7
UserController.cs
Edu.WebApi/Controllers/User/UserController.cs
+16
-0
No files found.
Edu.Model/ViewModel/User/DepartmentTree_ViewModel.cs
View file @
681fb74b
...
...
@@ -34,7 +34,7 @@ namespace Edu.Model.ViewModel.User
public
int
IsCompany
{
get
;
set
;
}
/// <summary>
/// 数据类型(1-部门,2-员工)
/// 数据类型(1-部门,2-员工
,3-岗位
)
/// </summary>
public
int
DataType
{
get
;
set
;
}
...
...
Edu.Module.User/DepartmentModule.cs
View file @
681fb74b
...
...
@@ -21,10 +21,11 @@ namespace Edu.Module.User
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
///
学校
仓储层对象
///
岗位
仓储层对象
/// </summary>
private
readonly
RB_
SchoolRepository
schoolRepository
=
new
RB_School
Repository
();
private
readonly
RB_
PostRepository
postRepository
=
new
RB_Post
Repository
();
/// <summary>
/// 获取部门分页列表
...
...
@@ -132,19 +133,24 @@ namespace Edu.Module.User
/// 获取部门结构树
/// </summary>
/// <param name="query"></param>
/// <param name="query">是否查询员工</param>
/// <param name="isQueryEmployee">是否查询员工</param>
/// <param name="isQueryPost">是否岗位</param>
/// <returns></returns>
public
List
<
DepartmentTree_ViewModel
>
GetDepartmentTreeModule
(
RB_Department_ViewModel
query
,
bool
isQueryEmployee
=
false
)
public
List
<
DepartmentTree_ViewModel
>
GetDepartmentTreeModule
(
RB_Department_ViewModel
query
,
bool
isQueryEmployee
=
false
,
bool
isQueryPost
=
false
)
{
//树形结构列表
List
<
DepartmentTree_ViewModel
>
list
=
new
List
<
DepartmentTree_ViewModel
>();
//所有的部门列表
var
deptList
=
GetDepartmentListModule
(
query
);
//员工列表
var
empList
=
new
List
<
Employee_ViewModel
>();
//岗位列表
var
postList
=
new
List
<
RB_Post_ViewModel
>();
if
(
deptList
==
null
)
{
deptList
=
new
List
<
RB_Department_ViewModel
>();
}
//查询员工
if
(
isQueryEmployee
)
{
empList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
...
...
@@ -153,6 +159,13 @@ namespace Edu.Module.User
School_Id
=
query
.
School_Id
});
}
if
(
isQueryPost
)
{
postList
=
postRepository
.
GetPostListRepository
(
new
RB_Post_ViewModel
()
{
Group_Id
=
query
.
Group_Id
,
});
}
if
(
deptList
!=
null
&&
deptList
.
Count
>
0
)
{
var
firstList
=
new
List
<
RB_Department_ViewModel
>();
...
...
@@ -200,7 +213,30 @@ namespace Edu.Module.User
}
}
#
endregion
var
childList
=
GetDeptTreeList
(
fItem
.
DeptId
,
deptList
,
empList
:
empList
);
#
region
添加岗位
if
(
isQueryPost
)
{
var
tempPostList
=
postList
?.
Where
(
qitem
=>
qitem
.
RB_Dept_Id
==
fItem
.
DeptId
)?.
ToList
();
if
(
tempPostList
!=
null
&&
tempPostList
.
Count
>
0
)
{
foreach
(
var
pItem
in
tempPostList
)
{
tModel
.
ChildList
.
Add
(
new
DepartmentTree_ViewModel
()
{
DeptId
=
pItem
.
PostId
,
DeptName
=
pItem
.
PostName
,
ParentId
=
0
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>(),
School_Id
=
fItem
.
School_Id
,
DataType
=
3
,
});
}
}
}
#
endregion
var
childList
=
GetDeptTreeList
(
fItem
.
DeptId
,
deptList
,
empList
:
empList
,
postList
:
postList
);
if
(
childList
!=
null
&&
childList
.
Count
>
0
)
{
tModel
.
ChildList
.
AddRange
(
childList
);
...
...
@@ -219,7 +255,7 @@ namespace Edu.Module.User
/// <param name="parentId">父节点编号</param>
/// <param name="sourceList">数据源列表</param>
/// <param name="empList">员工列表</param>
private
List
<
DepartmentTree_ViewModel
>
GetDeptTreeList
(
int
parentId
,
List
<
RB_Department_ViewModel
>
sourceList
,
List
<
Employee_ViewModel
>
empList
=
null
)
private
List
<
DepartmentTree_ViewModel
>
GetDeptTreeList
(
int
parentId
,
List
<
RB_Department_ViewModel
>
sourceList
,
List
<
Employee_ViewModel
>
empList
=
null
,
List
<
RB_Post_ViewModel
>
postList
=
null
)
{
List
<
DepartmentTree_ViewModel
>
treeList
=
new
List
<
DepartmentTree_ViewModel
>();
foreach
(
var
item
in
sourceList
.
Where
(
qitem
=>
qitem
.
ParentId
==
parentId
))
...
...
@@ -234,6 +270,7 @@ namespace Edu.Module.User
IsCompany
=
item
.
IsCompany
,
DataType
=
1
,
};
#
region
添加员工信息
if
(
empList
!=
null
&&
empList
.
Count
>
0
)
{
...
...
@@ -255,7 +292,30 @@ namespace Edu.Module.User
}
}
#
endregion
var
childList
=
GetDeptTreeList
(
item
.
DeptId
,
sourceList
);
#
region
添加岗位
if
(
postList
!=
null
&&
postList
.
Count
>
0
)
{
var
tempPostList
=
postList
?.
Where
(
qitem
=>
qitem
.
RB_Dept_Id
==
item
.
DeptId
)?.
ToList
();
if
(
tempPostList
!=
null
&&
tempPostList
.
Count
>
0
)
{
foreach
(
var
pItem
in
tempPostList
)
{
model
.
ChildList
.
Add
(
new
DepartmentTree_ViewModel
()
{
DeptId
=
pItem
.
PostId
,
DeptName
=
pItem
.
PostName
,
ParentId
=
0
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>(),
School_Id
=
item
.
School_Id
,
DataType
=
3
,
});
}
}
}
#
endregion
var
childList
=
GetDeptTreeList
(
item
.
DeptId
,
sourceList
,
empList
:
empList
,
postList
:
postList
);
if
(
childList
!=
null
&&
childList
.
Count
>
0
)
{
model
.
ChildList
.
AddRange
(
childList
);
...
...
Edu.WebApi/Controllers/User/UserController.cs
View file @
681fb74b
...
...
@@ -912,6 +912,22 @@ namespace Edu.WebApi.Controllers.User
return
ApiResult
.
Success
(
data
:
list
);
}
/// <summary>
/// 获取部门岗位树形列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDeptPostTree
()
{
var
query
=
new
RB_Department_ViewModel
()
{
Group_Id
=
base
.
UserInfo
.
Group_Id
,
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
)
};
var
list
=
departmentModule
.
GetDepartmentTreeModule
(
query
,
isQueryPost
:
true
);
return
ApiResult
.
Success
(
data
:
list
);
}
/// <summary>
/// 获取组织机构图
/// </summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment