Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
c02c8e0f
Commit
c02c8e0f
authored
May 16, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构菜单管理日志
parent
40d2f560
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
src/main/java/com/stylefeng/guns/common/constant/Dict.java
+6
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/DeleteDict.java
+2
-0
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
+16
-0
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
+9
-3
No files found.
src/main/java/com/stylefeng/guns/common/constant/Dict.java
View file @
c02c8e0f
...
...
@@ -28,4 +28,10 @@ public interface Dict {
*/
String
DeptDict
=
"DeptDict"
;
/**
* 菜单管理业务的字典
*/
String
MenuDict
=
"MenuDict"
;
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/DeleteDict.java
View file @
c02c8e0f
...
...
@@ -14,12 +14,14 @@ public class DeleteDict extends AbstractDictMap {
public
void
init
()
{
put
(
"roleId"
,
"角色名称"
);
put
(
"deptId"
,
"部门名称"
);
put
(
"menuId"
,
"菜单名称"
);
}
@Override
protected
void
initBeWrapped
()
{
putFieldWrapperMethodName
(
"roleId"
,
"getCacheObject"
);
putFieldWrapperMethodName
(
"deptId"
,
"getCacheObject"
);
putFieldWrapperMethodName
(
"menuId"
,
"getCacheObject"
);
}
}
src/main/java/com/stylefeng/guns/common/constant/factory/ConstantFactory.java
View file @
c02c8e0f
...
...
@@ -143,6 +143,22 @@ public class ConstantFactory {
}
/**
* 获取菜单名称
*/
public
String
getMenuName
(
Integer
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
return
""
;
}
else
{
Menu
menu
=
menuMapper
.
selectById
(
menuId
);
if
(
menu
==
null
)
{
return
""
;
}
else
{
return
menu
.
getName
();
}
}
}
/**
* 获取性别名称
*/
public
String
getSexName
(
Integer
sex
)
{
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
View file @
c02c8e0f
...
...
@@ -3,6 +3,8 @@ package com.stylefeng.guns.modular.system.controller;
import
com.stylefeng.guns.common.annotion.Permission
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.constant.Const
;
import
com.stylefeng.guns.common.constant.Dict
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.constant.state.MenuStatus
;
import
com.stylefeng.guns.common.constant.tips.Tip
;
import
com.stylefeng.guns.common.controller.BaseController
;
...
...
@@ -86,7 +88,7 @@ public class MenuController extends BaseController {
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/edit"
)
@ResponseBody
@BussinessLog
(
value
=
"修改菜单"
,
dict
=
"MenuDict"
)
@BussinessLog
(
value
=
"修改菜单"
,
key
=
"name"
,
dict
=
Dict
.
MenuDict
)
public
Tip
edit
(
@Valid
Menu
menu
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
...
...
@@ -110,7 +112,7 @@ public class MenuController extends BaseController {
*/
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/add"
)
@BussinessLog
(
value
=
"菜单新增"
,
key
=
"name"
,
dict
=
"MenuDict"
)
@BussinessLog
(
value
=
"菜单新增"
,
key
=
"name"
,
dict
=
Dict
.
MenuDict
)
@ResponseBody
public
Tip
add
(
@Valid
Menu
menu
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
...
...
@@ -126,12 +128,16 @@ public class MenuController extends BaseController {
*/
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/remove"
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId"
,
dict
=
"MenuDict"
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId"
,
dict
=
Dict
.
DeleteDict
)
@ResponseBody
public
Tip
remove
(
@RequestParam
Integer
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
//缓存菜单的名称
LogObjectHolder
.
me
().
set
(
ConstantFactory
.
me
().
getMenuName
(
menuId
));
this
.
menuService
.
delMenu
(
menuId
);
return
SUCCESS_TIP
;
}
...
...
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