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
8caa5f1c
Commit
8caa5f1c
authored
Nov 18, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
914f1c90
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
32 deletions
+51
-32
MenuTree_ViewModel.cs
Edu.Model/ViewModel/System/MenuTree_ViewModel.cs
+5
-0
RoleFunctionPermissionTree_ViewModel.cs
.../ViewModel/System/RoleFunctionPermissionTree_ViewModel.cs
+5
-0
MenuModule.cs
Edu.Module.System/MenuModule.cs
+4
-1
RoleModule.cs
Edu.Module.System/RoleModule.cs
+21
-29
PublicController.cs
Edu.WebApi/Controllers/Public/PublicController.cs
+16
-2
No files found.
Edu.Model/ViewModel/System/MenuTree_ViewModel.cs
View file @
8caa5f1c
...
...
@@ -12,6 +12,11 @@ namespace Edu.Model.ViewModel.System
/// </summary>
public
int
MenuId
{
get
;
set
;
}
/// <summary>
/// 上级菜单编号
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 菜单名称
/// </summary>
...
...
Edu.Model/ViewModel/System/RoleFunctionPermissionTree_ViewModel.cs
View file @
8caa5f1c
...
...
@@ -28,6 +28,11 @@ namespace Edu.Model.ViewModel.System
/// </summary>
public
int
Action_Id
{
get
;
set
;
}
/// <summary>
/// 上级节点编号
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 权限名称描述
/// </summary>
...
...
Edu.Module.System/MenuModule.cs
View file @
8caa5f1c
...
...
@@ -120,6 +120,7 @@ namespace Edu.Module.System
MenuName
=
fItem
.
MenuName
,
MenuUrl
=
fItem
.
MenuUrl
,
MenuIcon
=
fItem
.
MenuIcon
,
ParentId
=
0
,
SubList
=
new
List
<
MenuTree_ViewModel
>()
};
//二级菜单
...
...
@@ -134,10 +135,11 @@ namespace Edu.Module.System
MenuName
=
sItem
.
MenuName
,
MenuUrl
=
sItem
.
MenuUrl
,
MenuIcon
=
sItem
.
MenuIcon
,
ParentId
=
fItem
.
MenuId
,
SubList
=
new
List
<
MenuTree_ViewModel
>()
};
//三级菜单
var
thirdLevelList
=
list
.
Where
(
qitem
=>
qitem
.
MenuLevel
==
3
&&
qitem
.
ParentId
==
sItem
.
MenuId
).
ToList
();
var
thirdLevelList
=
list
.
Where
(
qitem
=>
qitem
.
MenuLevel
==
3
&&
qitem
.
ParentId
==
sItem
.
MenuId
).
ToList
();
if
(
thirdLevelList
!=
null
&&
thirdLevelList
.
Count
>
0
)
{
foreach
(
var
tItem
in
thirdLevelList
)
...
...
@@ -145,6 +147,7 @@ namespace Edu.Module.System
sModel
.
SubList
.
Add
(
new
MenuTree_ViewModel
()
{
MenuId
=
tItem
.
MenuId
,
ParentId
=
sItem
.
MenuId
,
MenuName
=
tItem
.
MenuName
,
MenuUrl
=
tItem
.
MenuUrl
,
MenuIcon
=
tItem
.
MenuIcon
,
...
...
Edu.Module.System/RoleModule.cs
View file @
8caa5f1c
...
...
@@ -180,12 +180,14 @@ namespace Edu.Module.System
CategoryName
=
item
.
CategoryName
,
IsChecked
=
false
,
Role_Id
=
roleId
,
ParentId
=
0
,
SubList
=
resultRoleFunctionTreeList
?.
Where
(
qitem
=>
qitem
.
CategoryId
==
item
.
CategoryId
)?.
ToList
()
??
new
List
<
RoleFunctionPermissionTree_ViewModel
>()
};
if
(
rootModel
!=
null
&&
rootModel
.
SubList
.
Count
>
0
)
{
foreach
(
var
subItem
in
rootModel
.
SubList
)
{
subItem
.
ParentId
=
Convert
.
ToInt32
(
cateModel
.
CategoryId
);
subItem
.
IsChecked
=
roleFunctionList
?.
Where
(
qitem
=>
(
int
)
qitem
.
Action_Id
==
subItem
.
Action_Id
)?.
Count
()
>
0
;
}
}
...
...
@@ -217,21 +219,33 @@ namespace Edu.Module.System
}
/// <summary>
/// 新增修改
角色菜单
权限
/// 新增修改
[角色菜单、角色功能]
权限
/// </summary>
/// <param name="list"></param>
/// <param name="roleMenuList">菜单权限列表</param>
/// <param name="roleFunctionList">功能权限列表</param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
SetRolePermissionModule
(
List
<
RB_Role_Permission_ViewModel
>
l
ist
)
public
bool
SetRolePermissionModule
(
List
<
RB_Role_Permission_ViewModel
>
roleMenuList
,
List
<
RB_Role_FunctionPermission_ViewModel
>
roleFunctionL
ist
)
{
bool
flag
=
false
;
if
(
list
!=
null
&&
list
.
Count
>
0
)
//菜单权限
if
(
roleMenuList
!=
null
&&
roleMenuList
.
Count
>
0
)
{
rolePermissionRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Role_Permission_ViewModel
.
Role_Id
),
l
ist
[
0
].
Role_Id
));
foreach
(
var
item
in
l
ist
)
rolePermissionRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Role_Permission_ViewModel
.
Role_Id
),
roleMenuL
ist
[
0
].
Role_Id
));
foreach
(
var
item
in
roleMenuL
ist
)
{
item
.
ID
=
0
;
flag
=
rolePermissionRepository
.
Insert
(
item
);
flag
=
rolePermissionRepository
.
Insert
(
item
)>
0
;
}
}
//功能权限
if
(
roleFunctionList
!=
null
&&
roleFunctionList
.
Count
>
0
)
{
roleFunctionPermissionRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Role_FunctionPermission_ViewModel
.
Role_Id
),
roleFunctionList
[
0
].
Role_Id
));
foreach
(
var
item
in
roleFunctionList
)
{
item
.
ID
=
0
;
flag
=
roleFunctionPermissionRepository
.
Insert
(
item
)>
0
;
}
}
return
flag
;
...
...
@@ -247,28 +261,6 @@ namespace Edu.Module.System
return
rolePermissionRepository
.
GetRolePermissionListRepository
(
query
);
}
/// <summary>
/// 新增修改角色功能权限
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
SetRoleFunctionPermissionModule
(
List
<
RB_Role_FunctionPermission_ViewModel
>
list
)
{
bool
flag
=
false
;
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
roleFunctionPermissionRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Role_FunctionPermission_ViewModel
.
Role_Id
),
list
[
0
].
Role_Id
));
foreach
(
var
item
in
list
)
{
item
.
ID
=
0
;
flag
=
roleFunctionPermissionRepository
.
Insert
(
item
);
}
}
return
flag
;
}
/// <summary>
/// 获取角色功能菜单列表
/// </summary>
...
...
Edu.WebApi/Controllers/Public/PublicController.cs
View file @
8caa5f1c
...
...
@@ -34,7 +34,7 @@ namespace Edu.WebApi.Controllers.Public
/// <summary>
/// 角色处理类对象
/// </summary>
private
readonly
RoleModule
roleModule
=
new
RoleModule
();
private
readonly
RoleModule
roleModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
RoleModule
>
();
#
region
省市区
...
...
@@ -222,10 +222,24 @@ namespace Edu.WebApi.Controllers.Public
var
roleId
=
base
.
ParmJObj
.
GetInt
(
"Role_Id"
);
if
(
roleId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
message
:
"请传递角色编号"
);
return
ApiResult
.
ParamIsNull
(
message
:
"请传递角色编号"
);
}
var
obj
=
roleModule
.
GetRolePermissionModule
(
roleId
);
return
ApiResult
.
Success
(
data
:
obj
);
}
/// <summary>
/// 保存角色权限
/// </summary>
/// <returns></returns>
public
ApiResult
SetRolePermission
()
{
var
roleMenu
=
base
.
ParmJObj
.
GetStringValue
(
"roleMenu"
);
var
roleFunction
=
base
.
ParmJObj
.
GetStringValue
(
"roleFunction"
);
var
rolePermissionList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
RB_Role_Permission_ViewModel
>>(
roleMenu
);
var
roleFunctionList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
RB_Role_FunctionPermission_ViewModel
>>(
roleFunction
);
bool
flag
=
roleModule
.
SetRolePermissionModule
(
rolePermissionList
,
roleFunctionList
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
}
\ No newline at end of file
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