Commit 001f2e2c by naan1993

日志记录的注解中dict字段改为class类型 根据#IF16S建议

parent 6c1fdabf
package com.stylefeng.guns.common.annotion; package com.stylefeng.guns.common.annotion;
import com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap;
import com.stylefeng.guns.common.constant.dictmap.base.SystemDict;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
...@@ -26,5 +29,5 @@ public @interface BussinessLog { ...@@ -26,5 +29,5 @@ public @interface BussinessLog {
/** /**
* 字典(用于查找key的中文名称和字段的中文名称) * 字典(用于查找key的中文名称和字段的中文名称)
*/ */
String dict() default "SystemDict"; Class<? extends AbstractDictMap> dict() default SystemDict.class;
} }
package com.stylefeng.guns.common.constant;
/**
* 字典常量
*
* @author fengshuonan
* @date 2017年5月16日21:44:56
*/
public interface Dict {
/**
* 系统管理员字典
*/
String UserDict = "UserDict";
/**
* 角色管理员字典
*/
String RoleDict = "RoleDict";
/**
* 删除业务的字典
*/
String DeleteDict = "DeleteDict";
/**
* 部门管理业务的字典
*/
String DeptDict = "DeptDict";
/**
* 菜单管理业务的字典
*/
String MenuDict = "MenuDict";
/**
* 字典管理业务的字典
*/
String DictMap = "DictMap";
/**
* 通知管理业务的字典
*/
String NoticeMap = "NoticeMap";
}
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);
}
}
}
}
...@@ -2,7 +2,6 @@ package com.stylefeng.guns.core.aop; ...@@ -2,7 +2,6 @@ package com.stylefeng.guns.core.aop;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap; 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;
...@@ -81,7 +80,7 @@ public class LogAop { ...@@ -81,7 +80,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(); Class dictClass = annotation.dict();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (Object param : params) { for (Object param : params) {
...@@ -97,7 +96,7 @@ public class LogAop { ...@@ -97,7 +96,7 @@ public class LogAop {
msg = Contrast.contrastObj(dictClass, key, obj1, obj2); msg = Contrast.contrastObj(dictClass, key, obj1, obj2);
} else { } else {
Map<String, String> parameters = HttpKit.getRequestParameters(); Map<String, String> parameters = HttpKit.getRequestParameters();
AbstractDictMap dictMap = DictMapFactory.createDictMap(dictClass); AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance();
msg = Contrast.parseMutiKey(dictMap,key,parameters); msg = Contrast.parseMutiKey(dictMap,key,parameters);
} }
......
...@@ -2,7 +2,6 @@ package com.stylefeng.guns.core.util; ...@@ -2,7 +2,6 @@ package com.stylefeng.guns.core.util;
import com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap; import com.stylefeng.guns.common.constant.dictmap.base.AbstractDictMap;
import com.stylefeng.guns.common.constant.dictmap.factory.DictFieldWarpperFactory; import com.stylefeng.guns.common.constant.dictmap.factory.DictFieldWarpperFactory;
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;
...@@ -68,8 +67,8 @@ public class Contrast { ...@@ -68,8 +67,8 @@ public class Contrast {
* @author stylefeng * @author stylefeng
* @Date 2017/5/9 19:34 * @Date 2017/5/9 19:34
*/ */
public static String contrastObj(String dictClass, String key, Object pojo1, Map<String, String> pojo2) { public static String contrastObj(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException {
AbstractDictMap dictMap = DictMapFactory.createDictMap(dictClass); AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance();
String str = parseMutiKey(dictMap, key, pojo2) + separator; String str = parseMutiKey(dictMap, key, pojo2) + separator;
try { try {
Class clazz = pojo1.getClass(); Class clazz = pojo1.getClass();
...@@ -119,8 +118,8 @@ public class Contrast { ...@@ -119,8 +118,8 @@ public class Contrast {
* @author stylefeng * @author stylefeng
* @Date 2017/5/9 19:34 * @Date 2017/5/9 19:34
*/ */
public static String contrastObjByName(String dictClass, String key, Object pojo1, Map<String, String> pojo2) { public static String contrastObjByName(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException {
AbstractDictMap dictMap = DictMapFactory.createDictMap(dictClass); AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance();
String str = parseMutiKey(dictMap, key, pojo2) + separator; String str = parseMutiKey(dictMap, key, pojo2) + separator;
try { try {
Class clazz = pojo1.getClass(); Class clazz = pojo1.getClass();
...@@ -132,14 +131,14 @@ public class Contrast { ...@@ -132,14 +131,14 @@ public class Contrast {
} }
String prefix = "get"; String prefix = "get";
int prefixLength = 3; int prefixLength = 3;
if(field.getType().getName().equals("java.lang.Boolean")){ if (field.getType().getName().equals("java.lang.Boolean")) {
prefix = "is"; prefix = "is";
prefixLength = 2; prefixLength = 2;
} }
Method getMethod = null; Method getMethod = null;
try{ try {
getMethod = clazz.getDeclaredMethod(prefix + StrKit.firstCharToUpperCase(field.getName())); getMethod = clazz.getDeclaredMethod(prefix + StrKit.firstCharToUpperCase(field.getName()));
}catch(java.lang.NoSuchMethodException e){ } catch (java.lang.NoSuchMethodException e) {
System.err.println("this className:" + clazz.getName() + " is not methodName: " + e.getMessage()); System.err.println("this className:" + clazz.getName() + " is not methodName: " + e.getMessage());
continue; continue;
} }
......
...@@ -2,7 +2,7 @@ package com.stylefeng.guns.modular.system.controller; ...@@ -2,7 +2,7 @@ package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.annotion.Permission; import com.stylefeng.guns.common.annotion.Permission;
import com.stylefeng.guns.common.constant.Dict; import com.stylefeng.guns.common.constant.dictmap.DeptDict;
import com.stylefeng.guns.common.constant.factory.ConstantFactory; import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.common.exception.BussinessException; import com.stylefeng.guns.common.exception.BussinessException;
...@@ -90,7 +90,7 @@ public class DeptController extends BaseController { ...@@ -90,7 +90,7 @@ public class DeptController extends BaseController {
/** /**
* 新增部门 * 新增部门
*/ */
@BussinessLog(value = "添加部门", key = "simplename", dict = Dict.DeptDict) @BussinessLog(value = "添加部门", key = "simplename", dict = DeptDict.class)
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@Permission @Permission
@ResponseBody @ResponseBody
...@@ -127,7 +127,7 @@ public class DeptController extends BaseController { ...@@ -127,7 +127,7 @@ public class DeptController extends BaseController {
/** /**
* 修改部门 * 修改部门
*/ */
@BussinessLog(value = "修改部门", key = "simplename", dict = Dict.DeptDict) @BussinessLog(value = "修改部门", key = "simplename", dict = DeptDict.class)
@RequestMapping(value = "/update") @RequestMapping(value = "/update")
@Permission @Permission
@ResponseBody @ResponseBody
...@@ -143,7 +143,7 @@ public class DeptController extends BaseController { ...@@ -143,7 +143,7 @@ public class DeptController extends BaseController {
/** /**
* 删除部门 * 删除部门
*/ */
@BussinessLog(value = "删除部门", key = "deptId", dict = Dict.DeleteDict) @BussinessLog(value = "删除部门", key = "deptId", dict = DeptDict.class)
@RequestMapping(value = "/delete") @RequestMapping(value = "/delete")
@Permission @Permission
@ResponseBody @ResponseBody
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.annotion.Permission; import com.stylefeng.guns.common.annotion.Permission;
import com.stylefeng.guns.common.constant.Const; import com.stylefeng.guns.common.constant.Const;
import com.stylefeng.guns.common.constant.dictmap.DictMap;
import com.stylefeng.guns.common.constant.factory.ConstantFactory; import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.common.exception.BussinessException; import com.stylefeng.guns.common.exception.BussinessException;
...@@ -82,7 +83,7 @@ public class DictController extends BaseController { ...@@ -82,7 +83,7 @@ public class DictController extends BaseController {
* *
* @param dictValues 格式例如 "1:启用;2:禁用;3:冻结" * @param dictValues 格式例如 "1:启用;2:禁用;3:冻结"
*/ */
@BussinessLog(value = "添加字典记录", key = "dictName,dictValues", dict = com.stylefeng.guns.common.constant.Dict.DictMap) @BussinessLog(value = "添加字典记录", key = "dictName,dictValues", dict = DictMap.class)
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
...@@ -118,7 +119,7 @@ public class DictController extends BaseController { ...@@ -118,7 +119,7 @@ public class DictController extends BaseController {
/** /**
* 修改字典 * 修改字典
*/ */
@BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = com.stylefeng.guns.common.constant.Dict.DictMap) @BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = DictMap.class)
@RequestMapping(value = "/update") @RequestMapping(value = "/update")
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
...@@ -133,7 +134,7 @@ public class DictController extends BaseController { ...@@ -133,7 +134,7 @@ public class DictController extends BaseController {
/** /**
* 删除字典记录 * 删除字典记录
*/ */
@BussinessLog(value = "删除字典记录", key = "dictId", dict = com.stylefeng.guns.common.constant.Dict.DeleteDict) @BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class)
@RequestMapping(value = "/delete") @RequestMapping(value = "/delete")
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
......
...@@ -3,7 +3,7 @@ package com.stylefeng.guns.modular.system.controller; ...@@ -3,7 +3,7 @@ package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.annotion.Permission; import com.stylefeng.guns.common.annotion.Permission;
import com.stylefeng.guns.common.constant.Const; import com.stylefeng.guns.common.constant.Const;
import com.stylefeng.guns.common.constant.Dict; import com.stylefeng.guns.common.constant.dictmap.MenuDict;
import com.stylefeng.guns.common.constant.factory.ConstantFactory; import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.constant.state.MenuStatus; import com.stylefeng.guns.common.constant.state.MenuStatus;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
...@@ -105,7 +105,7 @@ public class MenuController extends BaseController { ...@@ -105,7 +105,7 @@ public class MenuController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping(value = "/edit") @RequestMapping(value = "/edit")
@BussinessLog(value = "修改菜单", key = "name", dict = Dict.MenuDict) @BussinessLog(value = "修改菜单", key = "name", dict = MenuDict.class)
@ResponseBody @ResponseBody
public Tip edit(@Valid Menu menu, BindingResult result) { public Tip edit(@Valid Menu menu, BindingResult result) {
if (result.hasErrors()) { if (result.hasErrors()) {
...@@ -134,7 +134,7 @@ public class MenuController extends BaseController { ...@@ -134,7 +134,7 @@ public class MenuController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@BussinessLog(value = "菜单新增", key = "name", dict = Dict.MenuDict) @BussinessLog(value = "菜单新增", key = "name", dict = MenuDict.class)
@ResponseBody @ResponseBody
public Tip add(@Valid Menu menu, BindingResult result) { public Tip add(@Valid Menu menu, BindingResult result) {
if (result.hasErrors()) { if (result.hasErrors()) {
...@@ -160,7 +160,7 @@ public class MenuController extends BaseController { ...@@ -160,7 +160,7 @@ public class MenuController extends BaseController {
*/ */
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@RequestMapping(value = "/remove") @RequestMapping(value = "/remove")
@BussinessLog(value = "删除菜单", key = "menuId", dict = Dict.DeleteDict) @BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class)
@ResponseBody @ResponseBody
public Tip remove(@RequestParam Integer menuId) { public Tip remove(@RequestParam Integer menuId) {
if (ToolUtil.isEmpty(menuId)) { if (ToolUtil.isEmpty(menuId)) {
......
package com.stylefeng.guns.modular.system.controller; package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.constant.Dict; import com.stylefeng.guns.common.constant.dictmap.NoticeMap;
import com.stylefeng.guns.common.constant.factory.ConstantFactory; import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.common.exception.BussinessException; import com.stylefeng.guns.common.exception.BussinessException;
...@@ -95,7 +95,7 @@ public class NoticeController extends BaseController { ...@@ -95,7 +95,7 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@ResponseBody @ResponseBody
@BussinessLog(value = "新增通知",key = "title",dict = Dict.NoticeMap) @BussinessLog(value = "新增通知",key = "title",dict = NoticeMap.class)
public Object add(Notice notice) { public Object add(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) { if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL); throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
...@@ -111,7 +111,7 @@ public class NoticeController extends BaseController { ...@@ -111,7 +111,7 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping(value = "/delete") @RequestMapping(value = "/delete")
@ResponseBody @ResponseBody
@BussinessLog(value = "删除通知",key = "noticeId",dict = Dict.DeleteDict) @BussinessLog(value = "删除通知",key = "noticeId",dict = NoticeMap.class)
public Object delete(@RequestParam Integer noticeId) { public Object delete(@RequestParam Integer noticeId) {
//缓存通知名称 //缓存通知名称
...@@ -127,7 +127,7 @@ public class NoticeController extends BaseController { ...@@ -127,7 +127,7 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping(value = "/update") @RequestMapping(value = "/update")
@ResponseBody @ResponseBody
@BussinessLog(value = "修改通知",key = "title",dict = Dict.NoticeMap) @BussinessLog(value = "修改通知",key = "title",dict = NoticeMap.class)
public Object update(Notice notice) { public Object update(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) { if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL); throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
......
...@@ -3,8 +3,8 @@ package com.stylefeng.guns.modular.system.controller; ...@@ -3,8 +3,8 @@ package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.annotion.Permission; import com.stylefeng.guns.common.annotion.Permission;
import com.stylefeng.guns.common.constant.Const; import com.stylefeng.guns.common.constant.Const;
import com.stylefeng.guns.common.constant.Dict;
import com.stylefeng.guns.common.constant.cache.Cache; import com.stylefeng.guns.common.constant.cache.Cache;
import com.stylefeng.guns.common.constant.dictmap.RoleDict;
import com.stylefeng.guns.common.constant.factory.ConstantFactory; import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.common.exception.BussinessException; import com.stylefeng.guns.common.exception.BussinessException;
...@@ -121,7 +121,7 @@ public class RoleController extends BaseController { ...@@ -121,7 +121,7 @@ public class RoleController extends BaseController {
* 角色新增 * 角色新增
*/ */
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@BussinessLog(value = "添加角色", key = "name", dict = Dict.RoleDict) @BussinessLog(value = "添加角色", key = "name", dict = RoleDict.class)
@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) {
...@@ -137,7 +137,7 @@ public class RoleController extends BaseController { ...@@ -137,7 +137,7 @@ public class RoleController extends BaseController {
* 角色修改 * 角色修改
*/ */
@RequestMapping(value = "/edit") @RequestMapping(value = "/edit")
@BussinessLog(value = "修改角色", key = "name", dict = Dict.RoleDict) @BussinessLog(value = "修改角色", key = "name", dict = RoleDict.class)
@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) {
...@@ -155,7 +155,7 @@ public class RoleController extends BaseController { ...@@ -155,7 +155,7 @@ public class RoleController extends BaseController {
* 删除角色 * 删除角色
*/ */
@RequestMapping(value = "/remove") @RequestMapping(value = "/remove")
@BussinessLog(value = "删除角色", key = "roleId", dict = Dict.DeleteDict) @BussinessLog(value = "删除角色", key = "roleId", dict = RoleDict.class)
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
public Tip remove(@RequestParam Integer roleId) { public Tip remove(@RequestParam Integer roleId) {
...@@ -195,7 +195,7 @@ public class RoleController extends BaseController { ...@@ -195,7 +195,7 @@ public class RoleController extends BaseController {
* 配置权限 * 配置权限
*/ */
@RequestMapping("/setAuthority") @RequestMapping("/setAuthority")
@BussinessLog(value = "配置权限", key = "roleId,ids", dict = Dict.RoleDict) @BussinessLog(value = "配置权限", key = "roleId,ids", dict = RoleDict.class)
@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) {
......
...@@ -3,7 +3,7 @@ package com.stylefeng.guns.modular.system.controller; ...@@ -3,7 +3,7 @@ package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.annotion.BussinessLog; import com.stylefeng.guns.common.annotion.BussinessLog;
import com.stylefeng.guns.common.annotion.Permission; import com.stylefeng.guns.common.annotion.Permission;
import com.stylefeng.guns.common.constant.Const; import com.stylefeng.guns.common.constant.Const;
import com.stylefeng.guns.common.constant.Dict; import com.stylefeng.guns.common.constant.dictmap.UserDict;
import com.stylefeng.guns.common.constant.factory.ConstantFactory; import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.constant.state.ManagerStatus; import com.stylefeng.guns.common.constant.state.ManagerStatus;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
...@@ -177,7 +177,7 @@ public class UserMgrController extends BaseController { ...@@ -177,7 +177,7 @@ public class UserMgrController extends BaseController {
* 添加管理员 * 添加管理员
*/ */
@RequestMapping("/add") @RequestMapping("/add")
@BussinessLog(value = "添加管理员", key = "account", dict = Dict.UserDict) @BussinessLog(value = "添加管理员", key = "account", dict = UserDict.class)
@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) {
...@@ -207,7 +207,7 @@ public class UserMgrController extends BaseController { ...@@ -207,7 +207,7 @@ public class UserMgrController extends BaseController {
* @throws NoPermissionException * @throws NoPermissionException
*/ */
@RequestMapping("/edit") @RequestMapping("/edit")
@BussinessLog(value = "修改管理员", key = "account", dict = Dict.UserDict) @BussinessLog(value = "修改管理员", key = "account", dict = UserDict.class)
@ResponseBody @ResponseBody
public Tip edit(@Valid UserDto user, BindingResult result) throws NoPermissionException { public Tip edit(@Valid UserDto user, BindingResult result) throws NoPermissionException {
if (result.hasErrors()) { if (result.hasErrors()) {
...@@ -232,7 +232,7 @@ public class UserMgrController extends BaseController { ...@@ -232,7 +232,7 @@ public class UserMgrController extends BaseController {
* 删除管理员(逻辑删除) * 删除管理员(逻辑删除)
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
@BussinessLog(value = "删除管理员", key = "userId", dict = Dict.UserDict) @BussinessLog(value = "删除管理员", key = "userId", dict = UserDict.class)
@Permission @Permission
@ResponseBody @ResponseBody
public Tip delete(@RequestParam Integer userId) { public Tip delete(@RequestParam Integer userId) {
...@@ -265,7 +265,7 @@ public class UserMgrController extends BaseController { ...@@ -265,7 +265,7 @@ public class UserMgrController extends BaseController {
* 重置管理员的密码 * 重置管理员的密码
*/ */
@RequestMapping("/reset") @RequestMapping("/reset")
@BussinessLog(value = "重置管理员密码", key = "userId", dict = Dict.UserDict) @BussinessLog(value = "重置管理员密码", key = "userId", dict = UserDict.class)
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
public Tip reset(@RequestParam Integer userId) { public Tip reset(@RequestParam Integer userId) {
...@@ -284,7 +284,7 @@ public class UserMgrController extends BaseController { ...@@ -284,7 +284,7 @@ public class UserMgrController extends BaseController {
* 冻结用户 * 冻结用户
*/ */
@RequestMapping("/freeze") @RequestMapping("/freeze")
@BussinessLog(value = "冻结用户", key = "userId", dict = Dict.UserDict) @BussinessLog(value = "冻结用户", key = "userId", dict = UserDict.class)
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
public Tip freeze(@RequestParam Integer userId) { public Tip freeze(@RequestParam Integer userId) {
...@@ -304,7 +304,7 @@ public class UserMgrController extends BaseController { ...@@ -304,7 +304,7 @@ public class UserMgrController extends BaseController {
* 解除冻结用户 * 解除冻结用户
*/ */
@RequestMapping("/unfreeze") @RequestMapping("/unfreeze")
@BussinessLog(value = "解除冻结用户", key = "userId", dict = Dict.UserDict) @BussinessLog(value = "解除冻结用户", key = "userId", dict = UserDict.class)
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
public Tip unfreeze(@RequestParam Integer userId) { public Tip unfreeze(@RequestParam Integer userId) {
...@@ -320,7 +320,7 @@ public class UserMgrController extends BaseController { ...@@ -320,7 +320,7 @@ public class UserMgrController extends BaseController {
* 分配角色 * 分配角色
*/ */
@RequestMapping("/setRole") @RequestMapping("/setRole")
@BussinessLog(value = "分配角色", key = "userId,roleIds", dict = Dict.UserDict) @BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class)
@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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment