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
f5e7179e
Commit
f5e7179e
authored
Nov 19, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增页面
parent
f7264eb4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
236 additions
and
4 deletions
+236
-4
RB_Menu_Function.cs
Edu.Model/Entity/System/RB_Menu_Function.cs
+44
-0
RB_Menu_Function_ViewModel.cs
Edu.Model/ViewModel/System/RB_Menu_Function_ViewModel.cs
+15
-0
MenuModule.cs
Edu.Module.System/MenuModule.cs
+75
-4
RB_Menu_FunctionRepository.cs
Edu.Repository/System/RB_Menu_FunctionRepository.cs
+45
-0
PublicController.cs
Edu.WebApi/Controllers/Public/PublicController.cs
+57
-0
No files found.
Edu.Model/Entity/System/RB_Menu_Function.cs
0 → 100644
View file @
f5e7179e
using
Edu.Common.Enum
;
using
System
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.System
{
/// <summary>
/// 菜单功能权限实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Menu_Function
{
/// <summary>
/// 主键
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 菜单编号
/// </summary>
public
int
MenuId
{
get
;
set
;
}
/// <summary>
/// 功能名称
/// </summary>
public
string
FunctionName
{
get
;
set
;
}
/// <summary>
/// 功能代码
/// </summary>
public
string
FunctionCode
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remarks
{
get
;
set
;
}
/// <summary>
/// 状态(参考枚举)
/// </summary>
public
DateStateEnum
Status
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/System/RB_Menu_Function_ViewModel.cs
0 → 100644
View file @
f5e7179e
using
Edu.Model.Entity.System
;
namespace
Edu.Model.ViewModel.System
{
/// <summary>
/// 菜单功能权限视图实体类
/// </summary>
public
class
RB_Menu_Function_ViewModel
:
RB_Menu_Function
{
/// <summary>
/// 菜单名称
/// </summary>
public
string
MenuName
{
get
;
set
;
}
}
}
Edu.Module.System/MenuModule.cs
View file @
f5e7179e
...
...
@@ -16,6 +16,11 @@ namespace Edu.Module.System
/// </summary>
private
readonly
RB_MenuRepository
menuRepository
=
new
RB_MenuRepository
();
/// <summary>
/// 菜单功能权限仓储层对象
/// </summary>
private
readonly
RB_Menu_FunctionRepository
functionRepository
=
new
RB_Menu_FunctionRepository
();
/// <summary>
/// 获取菜单列表
/// </summary>
...
...
@@ -105,7 +110,7 @@ namespace Edu.Module.System
public
List
<
MenuTree_ViewModel
>
GetTreeMenuModule
(
RB_Menu_ViewModel
query
)
{
List
<
MenuTree_ViewModel
>
treeList
=
new
List
<
MenuTree_ViewModel
>();
var
list
=
GetMenuListModule
(
query
);
var
list
=
GetMenuListModule
(
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
//一级菜单
...
...
@@ -119,12 +124,12 @@ namespace Edu.Module.System
MenuId
=
fItem
.
MenuId
,
MenuName
=
fItem
.
MenuName
,
MenuUrl
=
fItem
.
MenuUrl
,
MenuIcon
=
fItem
.
MenuIcon
,
ParentId
=
0
,
MenuIcon
=
fItem
.
MenuIcon
,
ParentId
=
0
,
SubList
=
new
List
<
MenuTree_ViewModel
>()
};
//二级菜单
var
secondLevelList
=
list
.
Where
(
qitem
=>
qitem
.
MenuLevel
==
2
&&
qitem
.
ParentId
==
fItem
.
MenuId
).
ToList
();
var
secondLevelList
=
list
.
Where
(
qitem
=>
qitem
.
MenuLevel
==
2
&&
qitem
.
ParentId
==
fItem
.
MenuId
).
ToList
();
if
(
secondLevelList
!=
null
&&
secondLevelList
.
Count
>
0
)
{
foreach
(
var
sItem
in
secondLevelList
)
...
...
@@ -164,5 +169,71 @@ namespace Edu.Module.System
}
return
treeList
;
}
/// <summary>
/// 获取菜单功能权限分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Menu_Function_ViewModel
>
GetMenuFunctionPageListModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Menu_Function_ViewModel
query
)
{
return
functionRepository
.
GetMenuFunctionPageListRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
}
/// <summary>
/// 新增修改菜单功能权限
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public
bool
SetMenuFunctionModule
(
RB_Menu_Function_ViewModel
extModel
)
{
bool
flag
;
if
(
extModel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Menu_Function_ViewModel
.
FunctionName
),
extModel
.
FunctionName
},
{
nameof
(
RB_Menu_Function_ViewModel
.
FunctionCode
),
extModel
.
FunctionCode
},
{
nameof
(
RB_Menu_Function_ViewModel
.
Remarks
),
extModel
.
Remarks
},
};
flag
=
functionRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Menu_Function_ViewModel
.
Id
),
extModel
.
Id
));
}
else
{
var
newId
=
functionRepository
.
Insert
(
extModel
);
extModel
.
Id
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
/// <summary>
/// 根据编号获取菜单功能权限实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
RB_Menu_Function_ViewModel
GetMenuFunctionModule
(
object
Id
)
{
return
functionRepository
.
GetEntity
<
RB_Menu_Function_ViewModel
>(
Id
);
}
/// <summary>
/// 设置菜单功能权限状态
/// </summary>
/// <param name="Id">主键编号</param>
/// <param name="Status">状态(1-禁用,0-启用)</param>
/// <returns></returns>
public
bool
SetMenuFunctionStatusModule
(
object
Id
,
int
Status
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Menu_Function_ViewModel
.
Status
),
Status
},
};
var
flag
=
functionRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Menu_Function_ViewModel
.
Id
),
Id
));
return
flag
;
}
}
}
\ No newline at end of file
Edu.Repository/System/RB_Menu_FunctionRepository.cs
0 → 100644
View file @
f5e7179e
using
Edu.Model.Entity.System
;
using
Edu.Model.ViewModel.System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Repository.System
{
/// <summary>
/// 菜单功能权限仓储层
/// </summary>
public
class
RB_Menu_FunctionRepository
:
BaseRepository
<
RB_Menu_Function
>
{
/// <summary>
/// 获取菜单功能权限分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Menu_Function_ViewModel
>
GetMenuFunctionPageListRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Menu_Function_ViewModel
query
)
{
rowsCount
=
0
;
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*,IFNULL(B.MenuName,'') AS MenuName
FROM RB_Menu_Function AS A LEFT JOIN RB_Menu AS B ON A.MenuId=B.MenuId
WHERE 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
MenuId
>
0
)
{
builder
.
Append
(
$" AND A.
{
nameof
(
RB_Menu_Function_ViewModel
.
MenuId
)}
=
{
query
.
MenuId
}
"
);
}
return
GetPage
<
RB_Menu_Function_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
}
else
{
return
new
List
<
RB_Menu_Function_ViewModel
>();
}
}
}
}
\ No newline at end of file
Edu.WebApi/Controllers/Public/PublicController.cs
View file @
f5e7179e
...
...
@@ -130,6 +130,63 @@ namespace Edu.WebApi.Controllers.Public
}
#
endregion
#
region
菜单功能权限
/// <summary>
/// 获取菜单功能权限分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMenuFunctionPage
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_Menu_Function_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
var
list
=
menuModule
.
GetMenuFunctionPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
list
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 添加修改菜单功能权限
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetMenuFunction
()
{
var
extModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_Menu_Function_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
extModel
.
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
;
bool
flag
=
menuModule
.
SetMenuFunctionModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取菜单功能权限实体
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMenuFunction
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
,
0
);
var
extModel
=
menuModule
.
GetMenuFunctionModule
(
Id
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
/// <summary>
/// 修改菜单功能权限状态
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetMenuFunctionStatus
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
,
0
);
int
Status
=
base
.
ParmJObj
.
GetInt
(
"Status"
,
0
);
var
flag
=
menuModule
.
SetMenuFunctionStatusModule
(
Id
,
Status
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
#
region
角色管理
/// <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