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
24edb3f3
Commit
24edb3f3
authored
Nov 25, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
eca93b80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
452 additions
and
1 deletion
+452
-1
DepartmentModule.cs
Edu.Module.User/DepartmentModule.cs
+275
-0
EmployeeModule.cs
Edu.Module.User/EmployeeModule.cs
+81
-0
PostModule.cs
Edu.Module.User/PostModule.cs
+95
-0
ThirdController.cs
Edu.WebApi/Controllers/Third/ThirdController.cs
+1
-1
No files found.
Edu.Module.User/DepartmentModule.cs
0 → 100644
View file @
24edb3f3
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
System.Collections.Generic
;
using
System.Linq
;
using
VT.FW.DB
;
namespace
Edu.Module.User
{
/// <summary>
/// 部门处理类
/// </summary>
public
class
DepartmentModule
{
/// <summary>
/// 部门仓储层对象
/// </summary>
private
readonly
RB_DepartmentRepository
departmentRepository
=
new
RB_DepartmentRepository
();
/// <summary>
/// 账号仓储层对象
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 获取部门分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Department_ViewModel
>
GetDepartmentPageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Department_ViewModel
query
)
{
var
list
=
departmentRepository
.
GetDepartmentPageListRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
List
<
RB_Department_ViewModel
>
parentList
=
new
List
<
RB_Department_ViewModel
>();
List
<
Employee_ViewModel
>
empList
=
new
List
<
Employee_ViewModel
>();
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
//查询部门列表
string
Ids
=
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
qitem
.
ParentId
>
0
).
Select
(
qitem
=>
qitem
.
ParentId
));
if
(!
string
.
IsNullOrEmpty
(
Ids
))
{
parentList
=
GetDepartmentListModule
(
new
RB_Department_ViewModel
()
{
QDeptIds
=
Ids
});
}
//查询员工列表
string
persion
=
string
.
Join
(
","
,
list
.
Where
(
qitem
=>
!
string
.
IsNullOrEmpty
(
qitem
.
ManagerIds
)).
Select
(
qitem
=>
qitem
.
ManagerIds
));
if
(!
string
.
IsNullOrEmpty
(
persion
))
{
empList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
QIds
=
persion
});
}
}
foreach
(
var
item
in
list
)
{
//部门
item
.
ParentDeptName
=
parentList
?.
Where
(
qitem
=>
qitem
.
DeptId
==
item
.
ParentId
)?.
FirstOrDefault
()?.
DeptName
??
""
;
//负责人
string
persionName
=
""
;
if
(
item
.
ManagerList
!=
null
&&
item
.
ManagerList
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
ManagerList
)
{
persionName
+=
"、"
+
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
subItem
)?.
FirstOrDefault
()?.
EmployeeName
??
""
;
}
}
if
(!
string
.
IsNullOrEmpty
(
persionName
)
&&
persionName
!=
""
)
{
persionName
=
persionName
.
Substring
(
1
);
}
item
.
ManagerName
=
persionName
;
}
return
list
;
}
/// <summary>
/// 获取部门列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Department_ViewModel
>
GetDepartmentListModule
(
RB_Department_ViewModel
query
)
{
return
departmentRepository
.
GetDepartmentListRepository
(
query
);
}
/// <summary>
/// 获取当前部门的所有上级部门
/// </summary>
/// <param name="currentIds"></param>
/// <returns></returns>
public
List
<
RB_Department_ViewModel
>
GetAllSuperiorDepartmentListModule
(
object
DeptIds
)
{
return
departmentRepository
.
GetAllSuperiorDepartmentListRepository
(
DeptIds
);
}
/// <summary>
/// 获取部门结构树
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
DepartmentTree_ViewModel
>
GetDepartmentTreeModule
(
RB_Department_ViewModel
query
)
{
var
deptList
=
GetDepartmentListModule
(
query
);
List
<
DepartmentTree_ViewModel
>
list
=
new
List
<
DepartmentTree_ViewModel
>();
if
(
deptList
!=
null
&&
deptList
.
Count
>
0
)
{
var
firstList
=
deptList
.
Where
(
qitem
=>
qitem
.
ParentId
==
0
).
ToList
();
if
(
firstList
!=
null
&&
firstList
.
Count
>
0
)
{
foreach
(
var
fItem
in
firstList
)
{
DepartmentTree_ViewModel
tModel
=
new
DepartmentTree_ViewModel
()
{
DeptId
=
fItem
.
DeptId
,
DeptName
=
fItem
.
DeptName
,
ParentId
=
fItem
.
ParentId
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>()
};
tModel
.
ChildList
=
GetDeptTreeList
(
fItem
.
DeptId
,
deptList
);
list
.
Add
(
tModel
);
}
}
}
return
list
;
}
/// <summary>
/// 递归生成树形结构
/// </summary>
/// <param name="parentId">父节点编号</param>
/// <param name="sourceList">数据源列表</param>
private
List
<
DepartmentTree_ViewModel
>
GetDeptTreeList
(
int
parentId
,
List
<
RB_Department_ViewModel
>
sourceList
)
{
List
<
DepartmentTree_ViewModel
>
treeList
=
new
List
<
DepartmentTree_ViewModel
>();
foreach
(
var
item
in
sourceList
.
Where
(
qitem
=>
qitem
.
ParentId
==
parentId
))
{
DepartmentTree_ViewModel
model
=
new
DepartmentTree_ViewModel
()
{
DeptId
=
item
.
DeptId
,
DeptName
=
item
.
DeptName
,
ParentId
=
item
.
ParentId
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>(),
};
model
.
ChildList
=
GetDeptTreeList
(
item
.
DeptId
,
sourceList
);
treeList
.
Add
(
model
);
}
return
treeList
;
}
/// <summary>
/// 获取组织机构
/// </summary>
/// <param name="groupModel"></param>
/// <param name="query"></param>
/// <returns></returns>
public
object
GetOrganizationChartModule
(
RB_Group_ViewModel
groupModel
,
RB_Department_ViewModel
query
)
{
List
<
object
>
nodeList
=
new
List
<
object
>();
List
<
object
>
linkList
=
new
List
<
object
>();
var
list
=
GetDepartmentTreeModule
(
query
);
//根节点
nodeList
.
Add
(
new
{
id
=
groupModel
.
GId
,
text
=
groupModel
.
GroupName
,
color
=
"#2E4E8F"
,
});
foreach
(
var
item
in
list
)
{
nodeList
.
Add
(
new
{
id
=
item
.
DeptId
,
text
=
item
.
DeptName
,
});
linkList
.
Add
(
new
{
from
=
groupModel
.
GId
.
ToString
(),
to
=
item
.
DeptId
.
ToString
(),
});
GetChildDept
(
item
,
ref
nodeList
,
ref
linkList
);
}
var
obj
=
new
{
rootId
=
groupModel
.
GId
,
nodes
=
nodeList
,
links
=
linkList
};
return
obj
;
}
/// <summary>
/// 获取下级部门
/// </summary>
/// <param name="item"></param>
/// <param name="nodeList"></param>
/// <param name="linkList"></param>
public
void
GetChildDept
(
DepartmentTree_ViewModel
item
,
ref
List
<
object
>
nodeList
,
ref
List
<
object
>
linkList
)
{
if
(
item
.
ChildList
!=
null
&&
item
.
ChildList
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
ChildList
)
{
nodeList
.
Add
(
new
{
id
=
subItem
.
DeptId
,
text
=
subItem
.
DeptName
,
});
linkList
.
Add
(
new
{
from
=
item
.
DeptId
.
ToString
(),
to
=
subItem
.
DeptId
.
ToString
(),
});
GetChildDept
(
subItem
,
ref
nodeList
,
ref
linkList
);
}
}
}
/// <summary>
/// 新增修改部门
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetDepartmentModule
(
RB_Department_ViewModel
extModel
)
{
bool
flag
;
if
(
extModel
.
DeptId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Department_ViewModel
.
DeptName
),
extModel
.
DeptName
},
{
nameof
(
RB_Department_ViewModel
.
DeptTel
),
extModel
.
DeptTel
},
{
nameof
(
RB_Department_ViewModel
.
ManagerIds
),
extModel
.
ManagerIds
},
{
nameof
(
RB_Department_ViewModel
.
ParentId
),
extModel
.
ParentId
},
{
nameof
(
RB_Department_ViewModel
.
UpdateBy
),
extModel
.
UpdateBy
},
{
nameof
(
RB_Department_ViewModel
.
UpdateTime
),
extModel
.
UpdateTime
},
{
nameof
(
RB_Department_ViewModel
.
School_Id
),
extModel
.
School_Id
},
{
nameof
(
RB_Department_ViewModel
.
DeptTier
),
extModel
.
DeptTier
},
{
nameof
(
RB_Department_ViewModel
.
DeptSort
),
extModel
.
DeptSort
},
};
flag
=
departmentRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Department_ViewModel
.
DeptId
),
extModel
.
DeptId
));
}
else
{
var
newId
=
departmentRepository
.
Insert
(
extModel
);
extModel
.
DeptId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据部门编号获取部门实体
/// </summary>
/// <param name="DeptId"></param>
/// <returns></returns>
public
RB_Department_ViewModel
GetDepartmentModule
(
object
DeptId
)
{
return
departmentRepository
.
GetEntity
<
RB_Department_ViewModel
>(
DeptId
);
}
/// <summary>
/// 修改部门状态
/// </summary>
/// <param name="DeptId">部门编号</param>
/// <param name="Status">状态</param>
/// <returns></returns>
public
bool
RemoveDepartmentModule
(
int
DeptId
,
int
Status
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Department_ViewModel
.
Status
),
Status
}
};
return
departmentRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Department_ViewModel
.
DeptId
),
DeptId
));
}
}
}
\ No newline at end of file
Edu.Module.User/EmployeeModule.cs
0 → 100644
View file @
24edb3f3
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Module.User
{
/// <summary>
/// 员工处理类
/// </summary>
public
class
EmployeeModule
{
/// <summary>
/// 账号管理处理类对象
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 部门仓储层对象
/// </summary>
private
readonly
RB_DepartmentRepository
departmentRepository
=
new
RB_DepartmentRepository
();
/// <summary>
/// 获取员工列表【管理者、讲师、助教】
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
Employee_ViewModel
>
GetEmployeeListModule
(
Employee_ViewModel
query
)
{
return
accountRepository
.
GetEmployeeListRepository
(
query
);
}
/// <summary>
/// 根据员工部门获取员工列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
Employee_ViewModel
>
GetEmployeeByDeptTierModule
(
Employee_ViewModel
query
)
{
List
<
Employee_ViewModel
>
employeeList
=
new
List
<
Employee_ViewModel
>();
//获取当前部门所有的上级部门
if
(
query
.
DeptTier
==
1
)
{
var
currentDeptModel
=
departmentRepository
.
GetEntity
<
RB_Department_ViewModel
>(
query
.
Dept_Id
);
if
(
currentDeptModel
!=
null
&&
!
string
.
IsNullOrEmpty
(
currentDeptModel
.
ManagerIds
))
{
employeeList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
QIds
=
currentDeptModel
.
ManagerIds
});
}
}
else
{
var
allDeptList
=
departmentRepository
.
GetAllSuperiorDepartmentListRepository
(
query
.
Dept_Id
);
var
subList
=
allDeptList
.
Where
(
qitem
=>
qitem
.
DeptTier
==
(
query
.
DeptTier
-
1
));
if
(
subList
!=
null
&&
subList
.
Count
()
>
0
)
{
string
managerIds
=
"0"
;
foreach
(
var
item
in
subList
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
ManagerIds
))
{
managerIds
+=
","
+
item
.
ManagerIds
;
}
}
if
(!
string
.
IsNullOrEmpty
(
managerIds
))
{
employeeList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
QIds
=
managerIds
});
}
}
}
return
employeeList
;
}
}
}
Edu.Module.User/PostModule.cs
0 → 100644
View file @
24edb3f3
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
System.Collections.Generic
;
using
VT.FW.DB
;
namespace
Edu.Module.User
{
/// <summary>
/// 岗位处理类
/// </summary>
public
class
PostModule
{
/// <summary>
/// 岗位仓储层对象
/// </summary>
private
readonly
RB_PostRepository
postRepository
=
new
RB_PostRepository
();
/// <summary>
/// 获取岗位分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Post_ViewModel
>
GetPostPageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Post_ViewModel
query
)
{
var
list
=
postRepository
.
GetPostPageListRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
return
list
;
}
/// <summary>
/// 获取岗位列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Post_ViewModel
>
GetPostListModule
(
RB_Post_ViewModel
query
)
{
return
postRepository
.
GetPostListRepository
(
query
);
}
/// <summary>
/// 新增修改岗位
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetPostModule
(
RB_Post_ViewModel
extModel
)
{
bool
flag
;
if
(
extModel
.
PostId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Post_ViewModel
.
PostName
),
extModel
.
PostName
},
{
nameof
(
RB_Post_ViewModel
.
RB_Dept_Id
),
extModel
.
RB_Dept_Id
},
{
nameof
(
RB_Post_ViewModel
.
UpdateBy
),
extModel
.
UpdateBy
},
{
nameof
(
RB_Post_ViewModel
.
UpdateTime
),
extModel
.
UpdateTime
},
};
flag
=
postRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Post_ViewModel
.
PostId
),
extModel
.
PostId
));
}
else
{
var
newId
=
postRepository
.
Insert
(
extModel
);
extModel
.
PostId
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据岗位编号获取部门岗位
/// </summary>
/// <param name="DeptId"></param>
/// <returns></returns>
public
RB_Post_ViewModel
GetPostModule
(
object
PostId
)
{
return
postRepository
.
GetEntity
<
RB_Post_ViewModel
>(
PostId
);
}
/// <summary>
/// 修改岗位状态
/// </summary>
/// <param name="PostId">岗位编号</param>
/// <param name="Status">状态</param>
/// <returns></returns>
public
bool
RemovePostModule
(
int
PostId
,
int
Status
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Post_ViewModel
.
Status
),
Status
}
};
return
postRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Post_ViewModel
.
PostId
),
PostId
));
}
}
}
\ No newline at end of file
Edu.WebApi/Controllers/Third/ThirdController.cs
View file @
24edb3f3
...
...
@@ -23,7 +23,7 @@ namespace Edu.WebApi.Controllers.Third
/// <summary>
/// 员工处理类
/// </summary>
private
readonly
EmployeeModule
1
employeeModule
=
new
EmployeeModule1
();
private
readonly
EmployeeModule
employeeModule
=
new
EmployeeModule
();
/// <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