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
ca660632
Commit
ca660632
authored
May 06, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构日志记录
parent
daca4423
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
310 additions
and
70 deletions
+310
-70
src/main/java/com/stylefeng/guns/common/annotion/log/BussinessLog.java
+5
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/DeptDict.java
+22
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/DictMap.java
+17
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/LogDict.java
+17
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/MenuDict.java
+29
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/RoleDict.java
+23
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/UserDict.java
+26
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/base/AbstractDictMap.java
+29
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/base/SystemDict.java
+15
-0
src/main/java/com/stylefeng/guns/common/constant/dictmap/factory/DictMapFactory.java
+33
-0
src/main/java/com/stylefeng/guns/common/exception/BizExceptionEnum.java
+1
-0
src/main/java/com/stylefeng/guns/core/aop/LogAop.java
+13
-6
src/main/java/com/stylefeng/guns/core/util/Contrast.java
+7
-3
src/main/java/com/stylefeng/guns/modular/system/controller/DeptController.java
+6
-5
src/main/java/com/stylefeng/guns/modular/system/controller/DictController.java
+10
-9
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
+2
-0
src/main/java/com/stylefeng/guns/modular/system/controller/LoginLogController.java
+2
-0
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
+7
-7
src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
+6
-6
src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
+22
-22
src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
+0
-2
src/main/webapp/static/modular/system/dept/dept.js
+2
-1
src/main/webapp/static/modular/system/dict/dict.js
+4
-3
src/main/webapp/static/modular/system/menu/menu.js
+2
-1
src/main/webapp/static/modular/system/role/role.js
+2
-1
src/main/webapp/static/modular/system/user/user.js
+8
-4
No files found.
src/main/java/com/stylefeng/guns/common/annotion/log/BussinessLog.java
View file @
ca660632
...
@@ -22,4 +22,9 @@ public @interface BussinessLog {
...
@@ -22,4 +22,9 @@ public @interface BussinessLog {
* 被修改的实体的唯一标识,例如:菜单实体的唯一标识为"id"
* 被修改的实体的唯一标识,例如:菜单实体的唯一标识为"id"
*/
*/
String
key
()
default
"id"
;
String
key
()
default
"id"
;
/**
* 字典(用于查找key的中文名称和字段的中文名称)
*/
String
dict
()
default
"SystemDict"
;
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/DeptDict.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
/**
* 部门的映射
*
* @author fengshuonan
* @date 2017-05-06 15:01
*/
public
class
DeptDict
extends
AbstractDictMap
{
@Override
public
void
init
()
{
put
(
"deptId"
,
"部门id"
);
put
(
"num"
,
"部门排序"
);
put
(
"pid"
,
"部门父级"
);
put
(
"simplename"
,
"部门简称"
);
put
(
"fullname"
,
"部门全称"
);
put
(
"tips"
,
"备注"
);
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/DictMap.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
/**
* 字典map
*
* @author fengshuonan
* @date 2017-05-06 15:43
*/
public
class
DictMap
extends
AbstractDictMap
{
@Override
public
void
init
()
{
put
(
"dictId"
,
"字典id"
);
put
(
"dictName"
,
"字典名称"
);
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/LogDict.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
/**
* 日志的字典
*
* @author fengshuonan
* @date 2017-05-06 15:01
*/
public
class
LogDict
extends
AbstractDictMap
{
@Override
public
void
init
()
{
put
(
"tips"
,
"备注"
);
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/MenuDict.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
/**
* 菜单的字典
*
* @author fengshuonan
* @date 2017-05-06 15:01
*/
public
class
MenuDict
extends
AbstractDictMap
{
@Override
public
void
init
()
{
put
(
"menuId"
,
"菜单id"
);
put
(
"id"
,
"菜单id"
);
put
(
"code"
,
"菜单编号"
);
put
(
"pcode"
,
"菜单父编号"
);
put
(
"name"
,
"菜单名称"
);
put
(
"icon"
,
"菜单图标"
);
put
(
"url"
,
"url地址"
);
put
(
"num"
,
"菜单排序号"
);
put
(
"levels"
,
"菜单层级"
);
put
(
"tips"
,
"备注"
);
put
(
"status"
,
"菜单状态"
);
put
(
"isopen"
,
"是否打开"
);
put
(
""
,
""
);
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/RoleDict.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
/**
* 角色的字典
*
* @author fengshuonan
* @date 2017-05-06 15:01
*/
public
class
RoleDict
extends
AbstractDictMap
{
@Override
public
void
init
()
{
put
(
"roleId"
,
"角色id"
);
put
(
"id"
,
"角色id"
);
put
(
"num"
,
"角色排序"
);
put
(
"pid"
,
"角色的父级"
);
put
(
"name"
,
"角色名称"
);
put
(
"deptid"
,
"部门id"
);
put
(
"tips"
,
"备注"
);
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/UserDict.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
/**
* 用户的字典
*
* @author fengshuonan
* @date 2017-05-06 15:01
*/
public
class
UserDict
extends
AbstractDictMap
{
@Override
public
void
init
()
{
put
(
"userId"
,
"用户id"
);
put
(
"id"
,
"用户id"
);
put
(
"account"
,
"账号"
);
put
(
"name"
,
"名字"
);
put
(
"birthday"
,
"生日"
);
put
(
"sex"
,
"性别"
);
put
(
"email"
,
"电子邮件"
);
put
(
"phone"
,
"电话"
);
put
(
"roleid"
,
"角色id"
);
put
(
"deptid"
,
"部门id"
);
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/base/AbstractDictMap.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
.
base
;
import
java.util.HashMap
;
/**
* 字典映射抽象类
*
* @author fengshuonan
* @date 2017-05-06 14:58
*/
public
abstract
class
AbstractDictMap
{
protected
HashMap
<
String
,
String
>
dictory
=
new
HashMap
<>();
public
AbstractDictMap
(){
put
(
"id"
,
"主键id"
);
init
();
}
public
String
get
(
String
key
)
{
return
this
.
dictory
.
get
(
key
);
}
public
void
put
(
String
key
,
String
value
)
{
this
.
dictory
.
put
(
key
,
value
);
}
public
abstract
void
init
();
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/base/SystemDict.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
.
base
;
/**
* 系统相关的字典
*
* @author fengshuonan
* @date 2017-05-06 15:48
*/
public
class
SystemDict
extends
AbstractDictMap
{
@Override
public
void
init
()
{
}
}
src/main/java/com/stylefeng/guns/common/constant/dictmap/factory/DictMapFactory.java
0 → 100644
View file @
ca660632
package
com
.
stylefeng
.
guns
.
common
.
constant
.
dictmap
.
factory
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
import
com.stylefeng.guns.common.constant.dictmap.base.SystemDict
;
import
com.stylefeng.guns.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.common.exception.BussinessException
;
/**
* 字典的创建工厂
*
* @author fengshuonan
* @date 2017-05-06 15:12
*/
public
class
DictMapFactory
{
private
static
final
String
basePath
=
"com.stylefeng.guns.common.constant.dictmap."
;
/**
* 通过类名创建具体的字典类
*/
public
static
AbstractDictMap
createDictMap
(
String
className
)
{
if
(
"SystemDict"
.
equals
(
className
)){
return
new
SystemDict
();
}
else
{
try
{
Class
<
AbstractDictMap
>
clazz
=
(
Class
<
AbstractDictMap
>)
Class
.
forName
(
basePath
+
className
);
return
clazz
.
newInstance
();
}
catch
(
Exception
e
)
{
throw
new
BussinessException
(
BizExceptionEnum
.
ERROR_CREATE_DICT
);
}
}
}
}
src/main/java/com/stylefeng/guns/common/exception/BizExceptionEnum.java
View file @
ca660632
...
@@ -11,6 +11,7 @@ public enum BizExceptionEnum {
...
@@ -11,6 +11,7 @@ public enum BizExceptionEnum {
* 字典
* 字典
*/
*/
DICT_EXISTED
(
400
,
"字典已经存在"
),
DICT_EXISTED
(
400
,
"字典已经存在"
),
ERROR_CREATE_DICT
(
500
,
"创建字典失败"
),
/**
/**
...
...
src/main/java/com/stylefeng/guns/core/aop/LogAop.java
View file @
ca660632
package
com
.
stylefeng
.
guns
.
core
.
aop
;
package
com
.
stylefeng
.
guns
.
core
.
aop
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
import
com.stylefeng.guns.common.constant.dictmap.factory.DictMapFactory
;
import
com.stylefeng.guns.core.log.LogManager
;
import
com.stylefeng.guns.core.log.LogManager
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.log.factory.LogTaskFactory
;
import
com.stylefeng.guns.core.log.factory.LogTaskFactory
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
com.stylefeng.guns.core.support.HttpKit
;
import
com.stylefeng.guns.core.support.HttpKit
;
import
com.stylefeng.guns.core.support.StrKit
;
import
com.stylefeng.guns.core.util.Contrast
;
import
com.stylefeng.guns.core.util.Contrast
;
import
com.stylefeng.guns.core.util.DateUtil
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
@@ -67,6 +67,7 @@ public class LogAop {
...
@@ -67,6 +67,7 @@ public class LogAop {
BussinessLog
annotation
=
currentMethod
.
getAnnotation
(
BussinessLog
.
class
);
BussinessLog
annotation
=
currentMethod
.
getAnnotation
(
BussinessLog
.
class
);
String
bussinessName
=
annotation
.
value
();
String
bussinessName
=
annotation
.
value
();
String
key
=
annotation
.
key
();
String
key
=
annotation
.
key
();
String
dictClass
=
annotation
.
dict
();
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
Object
param
:
params
)
{
for
(
Object
param
:
params
)
{
...
@@ -75,14 +76,20 @@ public class LogAop {
...
@@ -75,14 +76,20 @@ public class LogAop {
}
}
//如果涉及到修改,比对变化
//如果涉及到修改,比对变化
String
msg
=
null
;
String
msg
;
if
(
bussinessName
.
indexOf
(
"修改"
)
!=
-
1
||
bussinessName
.
indexOf
(
"编辑"
)
!=
-
1
)
{
if
(
bussinessName
.
indexOf
(
"修改"
)
!=
-
1
||
bussinessName
.
indexOf
(
"编辑"
)
!=
-
1
)
{
Object
obj1
=
LogObjectHolder
.
me
().
get
();
Object
obj1
=
LogObjectHolder
.
me
().
get
();
Map
<
String
,
String
>
obj2
=
HttpKit
.
getRequestParameters
();
Map
<
String
,
String
>
obj2
=
HttpKit
.
getRequestParameters
();
msg
=
Contrast
.
contrastObj
(
key
,
obj1
,
obj2
);
msg
=
Contrast
.
contrastObj
(
dictClass
,
key
,
obj1
,
obj2
);
}
else
{
}
else
{
msg
=
ToolUtil
.
format
(
"[时间]:{} [类名]:{} [方法]:{} [参数]:{}"
,
DateUtil
.
getTime
(),
className
,
methodName
,
sb
.
toString
());
Map
<
String
,
String
>
parameters
=
HttpKit
.
getRequestParameters
();
msg
=
StrKit
.
removeSuffix
(
msg
,
"& "
);
String
value
=
parameters
.
get
(
key
);
if
(
ToolUtil
.
isNotEmpty
(
value
)){
AbstractDictMap
dictMap
=
DictMapFactory
.
createDictMap
(
dictClass
);
msg
=
dictMap
.
get
(
key
)
+
":"
+
value
;
}
else
{
msg
=
"无"
;
}
}
}
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
bussinessLog
(
user
.
getId
(),
bussinessName
,
className
,
methodName
,
msg
));
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
bussinessLog
(
user
.
getId
(),
bussinessName
,
className
,
methodName
,
msg
));
...
...
src/main/java/com/stylefeng/guns/core/util/Contrast.java
View file @
ca660632
package
com
.
stylefeng
.
guns
.
core
.
util
;
package
com
.
stylefeng
.
guns
.
core
.
util
;
import
com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap
;
import
com.stylefeng.guns.common.constant.dictmap.factory.DictMapFactory
;
import
com.stylefeng.guns.core.support.StrKit
;
import
com.stylefeng.guns.core.support.StrKit
;
import
java.beans.PropertyDescriptor
;
import
java.beans.PropertyDescriptor
;
...
@@ -49,9 +51,10 @@ public class Contrast {
...
@@ -49,9 +51,10 @@ public class Contrast {
return
str
;
return
str
;
}
}
public
static
String
contrastObj
(
String
key
,
Object
pojo1
,
Map
<
String
,
String
>
pojo2
)
{
public
static
String
contrastObj
(
String
dictClass
,
String
key
,
Object
pojo1
,
Map
<
String
,
String
>
pojo2
)
{
AbstractDictMap
dictMap
=
DictMapFactory
.
createDictMap
(
dictClass
);
String
value
=
pojo2
.
get
(
key
);
String
value
=
pojo2
.
get
(
key
);
String
str
=
key
+
"="
+
value
+
separator
;
String
str
=
dictMap
.
get
(
key
)
+
"="
+
value
+
separator
;
try
{
try
{
Class
clazz
=
pojo1
.
getClass
();
Class
clazz
=
pojo1
.
getClass
();
Field
[]
fields
=
pojo1
.
getClass
().
getDeclaredFields
();
Field
[]
fields
=
pojo1
.
getClass
().
getDeclaredFields
();
...
@@ -71,7 +74,8 @@ public class Contrast {
...
@@ -71,7 +74,8 @@ public class Contrast {
if
(
i
!=
1
)
{
if
(
i
!=
1
)
{
str
+=
separator
;
str
+=
separator
;
}
}
str
+=
"字段名称"
+
field
.
getName
()
+
",旧值:"
+
o1
+
",新值:"
+
o2
;
String
fieldName
=
dictMap
.
get
(
field
.
getName
());
str
+=
"字段名称:"
+
fieldName
+
",旧值:"
+
o1
+
",新值:"
+
o2
;
i
++;
i
++;
}
}
}
}
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/DeptController.java
View file @
ca660632
...
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Controller;
...
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Controller;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -84,7 +85,7 @@ public class DeptController extends BaseController {
...
@@ -84,7 +85,7 @@ public class DeptController extends BaseController {
/**
/**
* 新增部门
* 新增部门
*/
*/
@BussinessLog
(
"添加部门
"
)
@BussinessLog
(
value
=
"添加部门"
,
key
=
"simplename"
,
dict
=
"DeptDict
"
)
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@ResponseBody
@ResponseBody
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
...
@@ -117,7 +118,7 @@ public class DeptController extends BaseController {
...
@@ -117,7 +118,7 @@ public class DeptController extends BaseController {
/**
/**
* 修改部门
* 修改部门
*/
*/
@BussinessLog
(
"修改部门
"
)
@BussinessLog
(
value
=
"修改部门"
,
key
=
"simplename"
,
dict
=
"DeptDict
"
)
@RequestMapping
(
value
=
"/update"
)
@RequestMapping
(
value
=
"/update"
)
@ResponseBody
@ResponseBody
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
...
@@ -132,11 +133,11 @@ public class DeptController extends BaseController {
...
@@ -132,11 +133,11 @@ public class DeptController extends BaseController {
/**
/**
* 删除部门
* 删除部门
*/
*/
@BussinessLog
(
value
=
"删除部门"
,
key
=
"deptId"
)
@BussinessLog
(
value
=
"删除部门"
,
key
=
"deptId"
,
dict
=
"DeptDict"
)
@RequestMapping
(
value
=
"/delete
/{deptId}
"
)
@RequestMapping
(
value
=
"/delete"
)
@ResponseBody
@ResponseBody
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
public
Object
delete
(
@
PathVariable
(
"deptId"
)
Integer
deptId
)
{
public
Object
delete
(
@
RequestParam
Integer
deptId
)
{
deptMapper
.
deleteById
(
deptId
);
deptMapper
.
deleteById
(
deptId
);
return
SUCCESS_TIP
;
return
SUCCESS_TIP
;
}
}
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/DictController.java
View file @
ca660632
...
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Controller;
...
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Controller;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -67,9 +68,9 @@ public class DictController extends BaseController {
...
@@ -67,9 +68,9 @@ public class DictController extends BaseController {
@RequestMapping
(
"/dict_edit/{dictId}"
)
@RequestMapping
(
"/dict_edit/{dictId}"
)
public
String
deptUpdate
(
@PathVariable
Integer
dictId
,
Model
model
)
{
public
String
deptUpdate
(
@PathVariable
Integer
dictId
,
Model
model
)
{
Dict
dict
=
dictMapper
.
selectById
(
dictId
);
Dict
dict
=
dictMapper
.
selectById
(
dictId
);
model
.
addAttribute
(
"dict"
,
dict
);
model
.
addAttribute
(
"dict"
,
dict
);
List
<
Dict
>
subDicts
=
dictMapper
.
selectList
(
new
EntityWrapper
<
Dict
>().
eq
(
"pid"
,
dictId
));
List
<
Dict
>
subDicts
=
dictMapper
.
selectList
(
new
EntityWrapper
<
Dict
>().
eq
(
"pid"
,
dictId
));
model
.
addAttribute
(
"subDicts"
,
subDicts
);
model
.
addAttribute
(
"subDicts"
,
subDicts
);
LogObjectHolder
.
me
().
set
(
dict
);
LogObjectHolder
.
me
().
set
(
dict
);
return
PREFIX
+
"dict_edit.html"
;
return
PREFIX
+
"dict_edit.html"
;
}
}
...
@@ -79,7 +80,7 @@ public class DictController extends BaseController {
...
@@ -79,7 +80,7 @@ public class DictController extends BaseController {
*
*
* @param dictValues 格式例如 "1:启用;2:禁用;3:冻结"
* @param dictValues 格式例如 "1:启用;2:禁用;3:冻结"
*/
*/
@BussinessLog
(
value
=
"添加字典记录"
,
key
=
"dictName"
)
@BussinessLog
(
value
=
"添加字典记录"
,
key
=
"dictName"
,
dict
=
"DictMap"
)
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
...
@@ -113,26 +114,26 @@ public class DictController extends BaseController {
...
@@ -113,26 +114,26 @@ public class DictController extends BaseController {
/**
/**
* 修改字典
* 修改字典
*/
*/
@BussinessLog
(
"修改字典
"
)
@BussinessLog
(
value
=
"修改字典"
,
key
=
"dictName"
,
dict
=
"DictMap
"
)
@RequestMapping
(
value
=
"/update"
)
@RequestMapping
(
value
=
"/update"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Object
update
(
Integer
dictId
,
String
dictName
,
String
dictValues
)
{
public
Object
update
(
Integer
dictId
,
String
dictName
,
String
dictValues
)
{
if
(
ToolUtil
.
isOneEmpty
(
dictId
,
dictName
,
dictValues
))
{
if
(
ToolUtil
.
isOneEmpty
(
dictId
,
dictName
,
dictValues
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
dictService
.
editDict
(
dictId
,
dictName
,
dictValues
);
dictService
.
editDict
(
dictId
,
dictName
,
dictValues
);
return
super
.
SUCCESS_TIP
;
return
super
.
SUCCESS_TIP
;
}
}
/**
/**
* 删除字典记录
* 删除字典记录
*/
*/
@BussinessLog
(
value
=
"删除字典记录"
,
key
=
"dictId"
)
@BussinessLog
(
value
=
"删除字典记录"
,
key
=
"dictId"
,
dict
=
"DictMap"
)
@RequestMapping
(
value
=
"/delete
/{dictId}
"
)
@RequestMapping
(
value
=
"/delete"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Object
delete
(
@
PathVariable
(
"dictId"
)
Integer
dictId
)
{
public
Object
delete
(
@
RequestParam
Integer
dictId
)
{
this
.
dictService
.
delteDict
(
dictId
);
this
.
dictService
.
delteDict
(
dictId
);
return
SUCCESS_TIP
;
return
SUCCESS_TIP
;
}
}
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
View file @
ca660632
...
@@ -3,6 +3,7 @@ package com.stylefeng.guns.modular.system.controller;
...
@@ -3,6 +3,7 @@ package com.stylefeng.guns.modular.system.controller;
import
com.baomidou.mybatisplus.mapper.SqlRunner
;
import
com.baomidou.mybatisplus.mapper.SqlRunner
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.stylefeng.guns.common.annotion.Permission
;
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.Const
;
import
com.stylefeng.guns.common.constant.factory.PageFactory
;
import
com.stylefeng.guns.common.constant.factory.PageFactory
;
import
com.stylefeng.guns.common.constant.state.BizLogType
;
import
com.stylefeng.guns.common.constant.state.BizLogType
;
...
@@ -74,6 +75,7 @@ public class LogController extends BaseController {
...
@@ -74,6 +75,7 @@ public class LogController extends BaseController {
/**
/**
* 清空日志
* 清空日志
*/
*/
@BussinessLog
(
value
=
"清空业务日志"
)
@RequestMapping
(
"/delLog"
)
@RequestMapping
(
"/delLog"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/LoginLogController.java
View file @
ca660632
...
@@ -2,6 +2,7 @@ package com.stylefeng.guns.modular.system.controller;
...
@@ -2,6 +2,7 @@ package com.stylefeng.guns.modular.system.controller;
import
com.baomidou.mybatisplus.mapper.SqlRunner
;
import
com.baomidou.mybatisplus.mapper.SqlRunner
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.constant.factory.PageFactory
;
import
com.stylefeng.guns.common.constant.factory.PageFactory
;
import
com.stylefeng.guns.common.controller.BaseController
;
import
com.stylefeng.guns.common.controller.BaseController
;
import
com.stylefeng.guns.modular.system.dao.LogDao
;
import
com.stylefeng.guns.modular.system.dao.LogDao
;
...
@@ -54,6 +55,7 @@ public class LoginLogController extends BaseController {
...
@@ -54,6 +55,7 @@ public class LoginLogController extends BaseController {
/**
/**
* 清空日志
* 清空日志
*/
*/
@BussinessLog
(
"清空登录日志"
)
@RequestMapping
(
"/delLoginLog"
)
@RequestMapping
(
"/delLoginLog"
)
@ResponseBody
@ResponseBody
public
Object
delLog
()
{
public
Object
delLog
()
{
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
View file @
ca660632
...
@@ -86,7 +86,7 @@ public class MenuController extends BaseController {
...
@@ -86,7 +86,7 @@ public class MenuController extends BaseController {
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/edit"
)
@RequestMapping
(
value
=
"/edit"
)
@ResponseBody
@ResponseBody
@BussinessLog
(
"修改菜单
"
)
@BussinessLog
(
value
=
"修改菜单"
,
dict
=
"MenuDict
"
)
public
Tip
edit
(
@Valid
Menu
menu
,
BindingResult
result
)
{
public
Tip
edit
(
@Valid
Menu
menu
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
...
@@ -100,8 +100,8 @@ public class MenuController extends BaseController {
...
@@ -100,8 +100,8 @@ public class MenuController extends BaseController {
*/
*/
@RequestMapping
(
value
=
"/list"
)
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
menuName
,
@RequestParam
(
required
=
false
)
String
level
)
{
public
Object
list
(
@RequestParam
(
required
=
false
)
String
menuName
,
@RequestParam
(
required
=
false
)
String
level
)
{
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menuDao
.
selectMenus
(
menuName
,
level
);
List
<
Map
<
String
,
Object
>>
menus
=
this
.
menuDao
.
selectMenus
(
menuName
,
level
);
return
super
.
warpObject
(
new
MenuWarpper
(
menus
));
return
super
.
warpObject
(
new
MenuWarpper
(
menus
));
}
}
...
@@ -110,7 +110,7 @@ public class MenuController extends BaseController {
...
@@ -110,7 +110,7 @@ public class MenuController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@BussinessLog
(
"菜单新增
"
)
@BussinessLog
(
value
=
"菜单新增"
,
key
=
"name"
,
dict
=
"MenuDict
"
)
@ResponseBody
@ResponseBody
public
Tip
add
(
@Valid
Menu
menu
,
BindingResult
result
)
{
public
Tip
add
(
@Valid
Menu
menu
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
...
@@ -125,10 +125,10 @@ public class MenuController extends BaseController {
...
@@ -125,10 +125,10 @@ public class MenuController extends BaseController {
* 删除菜单
* 删除菜单
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/remove
/{menuId}
"
)
@RequestMapping
(
value
=
"/remove"
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId
"
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId"
,
dict
=
"MenuDict
"
)
@ResponseBody
@ResponseBody
public
Tip
remove
(
@
PathVariable
Integer
menuId
)
{
public
Tip
remove
(
@
RequestParam
Integer
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
View file @
ca660632
...
@@ -117,7 +117,7 @@ public class RoleController extends BaseController {
...
@@ -117,7 +117,7 @@ public class RoleController extends BaseController {
* 角色新增
* 角色新增
*/
*/
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@BussinessLog
(
"添加角色
"
)
@BussinessLog
(
value
=
"添加角色"
,
key
=
"name"
,
dict
=
"RoleDict
"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
add
(
@Valid
Role
role
,
BindingResult
result
)
{
public
Tip
add
(
@Valid
Role
role
,
BindingResult
result
)
{
...
@@ -133,7 +133,7 @@ public class RoleController extends BaseController {
...
@@ -133,7 +133,7 @@ public class RoleController extends BaseController {
* 角色修改
* 角色修改
*/
*/
@RequestMapping
(
value
=
"/edit"
)
@RequestMapping
(
value
=
"/edit"
)
@BussinessLog
(
"修改角色
"
)
@BussinessLog
(
value
=
"修改角色"
,
key
=
"name"
,
dict
=
"RoleDict
"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
edit
(
@Valid
Role
role
,
BindingResult
result
)
{
public
Tip
edit
(
@Valid
Role
role
,
BindingResult
result
)
{
...
@@ -150,11 +150,11 @@ public class RoleController extends BaseController {
...
@@ -150,11 +150,11 @@ public class RoleController extends BaseController {
/**
/**
* 删除角色
* 删除角色
*/
*/
@RequestMapping
(
value
=
"/remove
/{roleId}
"
)
@RequestMapping
(
value
=
"/remove"
)
@BussinessLog
(
value
=
"删除角色"
,
key
=
"roleId
"
)
@BussinessLog
(
value
=
"删除角色"
,
key
=
"roleId"
,
dict
=
"RoleDict
"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
remove
(
@
PathVariable
Integer
roleId
)
{
public
Tip
remove
(
@
RequestParam
Integer
roleId
)
{
if
(
ToolUtil
.
isEmpty
(
roleId
))
{
if
(
ToolUtil
.
isEmpty
(
roleId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -182,7 +182,7 @@ public class RoleController extends BaseController {
...
@@ -182,7 +182,7 @@ public class RoleController extends BaseController {
* 配置权限
* 配置权限
*/
*/
@RequestMapping
(
"/setAuthority"
)
@RequestMapping
(
"/setAuthority"
)
@BussinessLog
(
value
=
"配置权限"
,
key
=
"roleId
"
)
@BussinessLog
(
value
=
"配置权限"
,
key
=
"roleId"
,
dict
=
"RoleDict
"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
setAuthority
(
@RequestParam
(
"roleId"
)
Integer
roleId
,
@RequestParam
(
"ids"
)
String
ids
)
{
public
Tip
setAuthority
(
@RequestParam
(
"roleId"
)
Integer
roleId
,
@RequestParam
(
"ids"
)
String
ids
)
{
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
View file @
ca660632
...
@@ -119,7 +119,7 @@ public class UserMgrController extends BaseController {
...
@@ -119,7 +119,7 @@ public class UserMgrController extends BaseController {
* 跳转到修改密码界面
* 跳转到修改密码界面
*/
*/
@RequestMapping
(
"/user_chpwd"
)
@RequestMapping
(
"/user_chpwd"
)
public
String
chPwd
(){
public
String
chPwd
()
{
return
PREFIX
+
"user_chpwd.html"
;
return
PREFIX
+
"user_chpwd.html"
;
}
}
...
@@ -128,19 +128,19 @@ public class UserMgrController extends BaseController {
...
@@ -128,19 +128,19 @@ public class UserMgrController extends BaseController {
*/
*/
@RequestMapping
(
"/changePwd"
)
@RequestMapping
(
"/changePwd"
)
@ResponseBody
@ResponseBody
public
Object
changePwd
(
@RequestParam
String
oldPwd
,
@RequestParam
String
newPwd
,
@RequestParam
String
rePwd
)
{
public
Object
changePwd
(
@RequestParam
String
oldPwd
,
@RequestParam
String
newPwd
,
@RequestParam
String
rePwd
)
{
if
(!
newPwd
.
equals
(
rePwd
))
{
if
(!
newPwd
.
equals
(
rePwd
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
TWO_PWD_NOT_MATCH
);
throw
new
BussinessException
(
BizExceptionEnum
.
TWO_PWD_NOT_MATCH
);
}
}
Integer
userId
=
ShiroKit
.
getUser
().
getId
();
Integer
userId
=
ShiroKit
.
getUser
().
getId
();
User
user
=
userMapper
.
selectById
(
userId
);
User
user
=
userMapper
.
selectById
(
userId
);
String
oldMd5
=
ShiroKit
.
md5
(
oldPwd
,
user
.
getSalt
());
String
oldMd5
=
ShiroKit
.
md5
(
oldPwd
,
user
.
getSalt
());
if
(
user
.
getPassword
().
equals
(
oldMd5
))
{
if
(
user
.
getPassword
().
equals
(
oldMd5
))
{
String
newMd5
=
ShiroKit
.
md5
(
newPwd
,
user
.
getSalt
());
String
newMd5
=
ShiroKit
.
md5
(
newPwd
,
user
.
getSalt
());
user
.
setPassword
(
newMd5
);
user
.
setPassword
(
newMd5
);
user
.
updateById
();
user
.
updateById
();
return
SUCCESS_TIP
;
return
SUCCESS_TIP
;
}
else
{
}
else
{
throw
new
BussinessException
(
BizExceptionEnum
.
OLD_PWD_NOT_RIGHT
);
throw
new
BussinessException
(
BizExceptionEnum
.
OLD_PWD_NOT_RIGHT
);
}
}
}
}
...
@@ -151,7 +151,7 @@ public class UserMgrController extends BaseController {
...
@@ -151,7 +151,7 @@ public class UserMgrController extends BaseController {
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
beginTime
,
@RequestParam
(
required
=
false
)
String
endTime
)
{
public
Object
list
(
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
beginTime
,
@RequestParam
(
required
=
false
)
String
endTime
)
{
List
<
Map
<
String
,
Object
>>
users
=
managerDao
.
selectUsers
(
name
,
beginTime
,
endTime
);
List
<
Map
<
String
,
Object
>>
users
=
managerDao
.
selectUsers
(
name
,
beginTime
,
endTime
);
return
new
UserWarpper
(
users
).
warp
();
return
new
UserWarpper
(
users
).
warp
();
}
}
...
@@ -159,7 +159,7 @@ public class UserMgrController extends BaseController {
...
@@ -159,7 +159,7 @@ public class UserMgrController extends BaseController {
* 添加管理员
* 添加管理员
*/
*/
@RequestMapping
(
"/add"
)
@RequestMapping
(
"/add"
)
@BussinessLog
(
"添加管理员
"
)
@BussinessLog
(
value
=
"添加管理员"
,
key
=
"name"
,
dict
=
"UserDict
"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
add
(
@Valid
UserDto
user
,
BindingResult
result
)
{
public
Tip
add
(
@Valid
UserDto
user
,
BindingResult
result
)
{
...
@@ -189,7 +189,7 @@ public class UserMgrController extends BaseController {
...
@@ -189,7 +189,7 @@ public class UserMgrController extends BaseController {
* @throws NoPermissionException
* @throws NoPermissionException
*/
*/
@RequestMapping
(
"/edit"
)
@RequestMapping
(
"/edit"
)
@BussinessLog
(
"修改管理员
"
)
@BussinessLog
(
value
=
"修改管理员"
,
dict
=
"UserDict
"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
edit
(
@Valid
UserDto
user
,
BindingResult
result
)
throws
NoPermissionException
{
public
Tip
edit
(
@Valid
UserDto
user
,
BindingResult
result
)
throws
NoPermissionException
{
...
@@ -213,11 +213,11 @@ public class UserMgrController extends BaseController {
...
@@ -213,11 +213,11 @@ public class UserMgrController extends BaseController {
/**
/**
* 删除管理员(逻辑删除)
* 删除管理员(逻辑删除)
*/
*/
@RequestMapping
(
"/delete
/{userId}
"
)
@RequestMapping
(
"/delete"
)
@BussinessLog
(
value
=
"删除管理员"
,
key
=
"userId"
)
@BussinessLog
(
value
=
"删除管理员"
,
key
=
"userId"
,
dict
=
"UserDict"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
delete
(
@
PathVariable
Integer
userId
)
{
public
Tip
delete
(
@
RequestParam
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -240,11 +240,11 @@ public class UserMgrController extends BaseController {
...
@@ -240,11 +240,11 @@ public class UserMgrController extends BaseController {
/**
/**
* 重置管理员的密码
* 重置管理员的密码
*/
*/
@RequestMapping
(
"/reset
/{userId}
"
)
@RequestMapping
(
"/reset"
)
@BussinessLog
(
value
=
"重置管理员密码"
,
key
=
"userId"
)
@BussinessLog
(
value
=
"重置管理员密码"
,
key
=
"userId"
,
dict
=
"UserDict"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
reset
(
@
PathVariable
Integer
userId
)
{
public
Tip
reset
(
@
RequestParam
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -258,11 +258,11 @@ public class UserMgrController extends BaseController {
...
@@ -258,11 +258,11 @@ public class UserMgrController extends BaseController {
/**
/**
* 冻结用户
* 冻结用户
*/
*/
@RequestMapping
(
"/freeze
/{userId}
"
)
@RequestMapping
(
"/freeze"
)
@BussinessLog
(
value
=
"冻结用户"
,
key
=
"userId"
)
@BussinessLog
(
value
=
"冻结用户"
,
key
=
"userId"
,
dict
=
"UserDict"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
freeze
(
@
PathVariable
Integer
userId
)
{
public
Tip
freeze
(
@
RequestParam
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -273,11 +273,11 @@ public class UserMgrController extends BaseController {
...
@@ -273,11 +273,11 @@ public class UserMgrController extends BaseController {
/**
/**
* 解除冻结用户
* 解除冻结用户
*/
*/
@RequestMapping
(
"/unfreeze
/{userId}
"
)
@RequestMapping
(
"/unfreeze"
)
@BussinessLog
(
value
=
"解除冻结用户"
,
key
=
"userId"
)
@BussinessLog
(
value
=
"解除冻结用户"
,
key
=
"userId"
,
dict
=
"UserDict"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
unfreeze
(
@
PathVariable
Integer
userId
)
{
public
Tip
unfreeze
(
@
RequestParam
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
...
@@ -289,7 +289,7 @@ public class UserMgrController extends BaseController {
...
@@ -289,7 +289,7 @@ public class UserMgrController extends BaseController {
* 分配角色
* 分配角色
*/
*/
@RequestMapping
(
"/setRole"
)
@RequestMapping
(
"/setRole"
)
@BussinessLog
(
value
=
"分配角色"
,
key
=
"userId"
)
@BussinessLog
(
value
=
"分配角色"
,
key
=
"userId"
,
dict
=
"UserDict"
)
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@ResponseBody
@ResponseBody
public
Tip
setRole
(
@RequestParam
(
"userId"
)
Integer
userId
,
@RequestParam
(
"roleIds"
)
String
roleIds
)
{
public
Tip
setRole
(
@RequestParam
(
"userId"
)
Integer
userId
,
@RequestParam
(
"roleIds"
)
String
roleIds
)
{
...
...
src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
View file @
ca660632
package
com
.
stylefeng
.
guns
.
modular
.
system
.
service
.
impl
;
package
com
.
stylefeng
.
guns
.
modular
.
system
.
service
.
impl
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.service.IRoleService
;
import
com.stylefeng.guns.modular.system.service.IRoleService
;
...
@@ -25,7 +24,6 @@ public class RoleServiceImpl implements IRoleService {
...
@@ -25,7 +24,6 @@ public class RoleServiceImpl implements IRoleService {
RelationMapper
relationMapper
;
RelationMapper
relationMapper
;
@Override
@Override
@BussinessLog
(
"分配角色权限"
)
@Transactional
(
readOnly
=
false
)
@Transactional
(
readOnly
=
false
)
public
void
setAuthority
(
Integer
roleId
,
String
ids
)
{
public
void
setAuthority
(
Integer
roleId
,
String
ids
)
{
...
...
src/main/webapp/static/modular/system/dept/dept.js
View file @
ca660632
...
@@ -73,12 +73,13 @@ Dept.openDeptDetail = function () {
...
@@ -73,12 +73,13 @@ Dept.openDeptDetail = function () {
*/
*/
Dept
.
delete
=
function
()
{
Dept
.
delete
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/delete
/"
+
this
.
seItem
.
id
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/delete
"
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Feng
.
success
(
"删除成功!"
);
Dept
.
table
.
refresh
();
Dept
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
Feng
.
error
(
"删除失败!"
);
});
});
ajax
.
set
(
"deptId"
,
this
.
seItem
.
id
);
ajax
.
start
();
ajax
.
start
();
}
}
};
};
...
...
src/main/webapp/static/modular/system/dict/dict.js
View file @
ca660632
...
@@ -25,10 +25,10 @@ Dict.initColumn = function () {
...
@@ -25,10 +25,10 @@ Dict.initColumn = function () {
*/
*/
Dict
.
check
=
function
()
{
Dict
.
check
=
function
()
{
var
selected
=
$
(
'#'
+
this
.
id
).
bootstrapTable
(
'getSelections'
);
var
selected
=
$
(
'#'
+
this
.
id
).
bootstrapTable
(
'getSelections'
);
if
(
selected
.
length
==
0
)
{
if
(
selected
.
length
==
0
)
{
Feng
.
info
(
"请先选中表格中的某一记录!"
);
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
return
false
;
}
else
{
}
else
{
Dict
.
seItem
=
selected
[
0
];
Dict
.
seItem
=
selected
[
0
];
return
true
;
return
true
;
}
}
...
@@ -71,12 +71,13 @@ Dict.openDictDetail = function () {
...
@@ -71,12 +71,13 @@ Dict.openDictDetail = function () {
*/
*/
Dict
.
delete
=
function
()
{
Dict
.
delete
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dict/delete
/"
+
this
.
seItem
.
id
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dict/delete
"
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Feng
.
success
(
"删除成功!"
);
Dict
.
table
.
refresh
();
Dict
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
Feng
.
error
(
"删除失败!"
);
});
});
ajax
.
set
(
"dictId"
,
this
.
seItem
.
id
);
ajax
.
start
();
ajax
.
start
();
}
}
};
};
...
...
src/main/webapp/static/modular/system/menu/menu.js
View file @
ca660632
...
@@ -77,12 +77,13 @@ Menu.openChangeMenu = function () {
...
@@ -77,12 +77,13 @@ Menu.openChangeMenu = function () {
*/
*/
Menu
.
delMenu
=
function
()
{
Menu
.
delMenu
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/remove
/"
+
this
.
seItem
.
id
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/menu/remove
"
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Feng
.
success
(
"删除成功!"
);
Menu
.
table
.
refresh
();
Menu
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
Feng
.
error
(
"删除失败!"
);
});
});
ajax
.
set
(
"menuId"
,
this
.
seItem
.
id
);
ajax
.
start
();
ajax
.
start
();
}
}
};
};
...
...
src/main/webapp/static/modular/system/role/role.js
View file @
ca660632
...
@@ -74,12 +74,13 @@ Role.openChangeRole = function () {
...
@@ -74,12 +74,13 @@ Role.openChangeRole = function () {
*/
*/
Role
.
delRole
=
function
()
{
Role
.
delRole
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/role/remove
/"
+
this
.
seItem
.
id
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/role/remove
"
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Feng
.
success
(
"删除成功!"
);
Role
.
table
.
refresh
();
Role
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
Feng
.
error
(
"删除失败!"
);
});
});
ajax
.
set
(
"roleId"
,
this
.
seItem
.
id
);
ajax
.
start
();
ajax
.
start
();
}
}
};
};
...
...
src/main/webapp/static/modular/system/user/user.js
View file @
ca660632
...
@@ -98,12 +98,13 @@ MgrUser.roleAssign = function () {
...
@@ -98,12 +98,13 @@ MgrUser.roleAssign = function () {
MgrUser
.
delMgrUser
=
function
()
{
MgrUser
.
delMgrUser
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
userId
=
this
.
seItem
.
id
;
var
userId
=
this
.
seItem
.
id
;
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/delete
/"
+
userId
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/delete
"
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Feng
.
success
(
"删除成功!"
);
MgrUser
.
table
.
refresh
();
MgrUser
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
);
Feng
.
error
(
"删除失败!"
);
});
});
ajax
.
set
(
"userId"
,
userId
);
ajax
.
start
();
ajax
.
start
();
}
}
};
};
...
@@ -115,12 +116,13 @@ MgrUser.delMgrUser = function () {
...
@@ -115,12 +116,13 @@ MgrUser.delMgrUser = function () {
MgrUser
.
freezeAccount
=
function
()
{
MgrUser
.
freezeAccount
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
userId
=
this
.
seItem
.
id
;
var
userId
=
this
.
seItem
.
id
;
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/freeze
/"
+
userId
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/freeze
"
,
function
(
data
)
{
Feng
.
success
(
"冻结成功!"
);
Feng
.
success
(
"冻结成功!"
);
MgrUser
.
table
.
refresh
();
MgrUser
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"冻结失败!"
);
Feng
.
error
(
"冻结失败!"
);
});
});
ajax
.
set
(
"userId"
,
userId
);
ajax
.
start
();
ajax
.
start
();
}
}
};
};
...
@@ -132,12 +134,13 @@ MgrUser.freezeAccount = function () {
...
@@ -132,12 +134,13 @@ MgrUser.freezeAccount = function () {
MgrUser
.
unfreeze
=
function
()
{
MgrUser
.
unfreeze
=
function
()
{
if
(
this
.
check
())
{
if
(
this
.
check
())
{
var
userId
=
this
.
seItem
.
id
;
var
userId
=
this
.
seItem
.
id
;
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/unfreeze
/"
+
userId
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/unfreeze
"
,
function
(
data
)
{
Feng
.
success
(
"解除冻结成功!"
);
Feng
.
success
(
"解除冻结成功!"
);
MgrUser
.
table
.
refresh
();
MgrUser
.
table
.
refresh
();
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"解除冻结失败!"
);
Feng
.
error
(
"解除冻结失败!"
);
});
});
ajax
.
set
(
"userId"
,
userId
);
ajax
.
start
();
ajax
.
start
();
}
}
}
}
...
@@ -152,11 +155,12 @@ MgrUser.resetPwd = function () {
...
@@ -152,11 +155,12 @@ MgrUser.resetPwd = function () {
btn
:
[
'确定'
,
'取消'
],
btn
:
[
'确定'
,
'取消'
],
shade
:
false
//不显示遮罩
shade
:
false
//不显示遮罩
},
function
()
{
},
function
()
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/reset
/"
+
userId
,
function
(
data
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/reset
"
,
function
(
data
)
{
Feng
.
success
(
"重置密码成功!"
);
Feng
.
success
(
"重置密码成功!"
);
},
function
(
data
)
{
},
function
(
data
)
{
Feng
.
error
(
"重置密码失败!"
);
Feng
.
error
(
"重置密码失败!"
);
});
});
ajax
.
set
(
"userId"
,
userId
);
ajax
.
start
();
ajax
.
start
();
});
});
}
}
...
...
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