Commit 49f6587c by fsn

重构字典管理日志

parent c02c8e0f
...@@ -33,5 +33,9 @@ public interface Dict { ...@@ -33,5 +33,9 @@ public interface Dict {
*/ */
String MenuDict = "MenuDict"; String MenuDict = "MenuDict";
/**
* 字典管理业务的字典
*/
String DictMap = "DictMap";
} }
...@@ -15,6 +15,7 @@ public class DeleteDict extends AbstractDictMap { ...@@ -15,6 +15,7 @@ public class DeleteDict extends AbstractDictMap {
put("roleId","角色名称"); put("roleId","角色名称");
put("deptId", "部门名称"); put("deptId", "部门名称");
put("menuId", "菜单名称"); put("menuId", "菜单名称");
put("dictId", "字典名称");
} }
@Override @Override
...@@ -22,6 +23,7 @@ public class DeleteDict extends AbstractDictMap { ...@@ -22,6 +23,7 @@ public class DeleteDict extends AbstractDictMap {
putFieldWrapperMethodName("roleId","getCacheObject"); putFieldWrapperMethodName("roleId","getCacheObject");
putFieldWrapperMethodName("deptId","getCacheObject"); putFieldWrapperMethodName("deptId","getCacheObject");
putFieldWrapperMethodName("menuId","getCacheObject"); putFieldWrapperMethodName("menuId","getCacheObject");
putFieldWrapperMethodName("dictId","getCacheObject");
} }
} }
...@@ -12,8 +12,9 @@ public class DictMap extends AbstractDictMap { ...@@ -12,8 +12,9 @@ public class DictMap extends AbstractDictMap {
@Override @Override
public void init() { public void init() {
put("dictId","字典id"); put("dictId","字典名称");
put("dictName","字典名称"); put("dictName","字典名称");
put("dictValues","字典内容");
} }
@Override @Override
......
...@@ -159,6 +159,22 @@ public class ConstantFactory { ...@@ -159,6 +159,22 @@ public class ConstantFactory {
} }
/** /**
* 获取字典名称
*/
public String getDictName(Integer dictId){
if (ToolUtil.isEmpty(dictId)) {
return "";
} else {
Dict dict = dictMapper.selectById(dictId);
if (dict == null) {
return "";
} else {
return dict.getName();
}
}
}
/**
* 获取性别名称 * 获取性别名称
*/ */
public String getSexName(Integer sex) { public String getSexName(Integer sex) {
......
...@@ -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.Permission; import com.stylefeng.guns.common.annotion.Permission;
import com.stylefeng.guns.common.annotion.log.BussinessLog; 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.ConstantFactory;
import com.stylefeng.guns.common.controller.BaseController; import com.stylefeng.guns.common.controller.BaseController;
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;
...@@ -80,7 +81,7 @@ public class DictController extends BaseController { ...@@ -80,7 +81,7 @@ public class DictController extends BaseController {
* *
* @param dictValues 格式例如 "1:启用;2:禁用;3:冻结" * @param dictValues 格式例如 "1:启用;2:禁用;3:冻结"
*/ */
@BussinessLog(value = "添加字典记录", key = "dictName", dict = "DictMap") @BussinessLog(value = "添加字典记录", key = "dictName,dictValues", dict = com.stylefeng.guns.common.constant.Dict.DictMap)
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
...@@ -114,7 +115,7 @@ public class DictController extends BaseController { ...@@ -114,7 +115,7 @@ public class DictController extends BaseController {
/** /**
* 修改字典 * 修改字典
*/ */
@BussinessLog(value = "修改字典", key = "dictName", dict = "DictMap") @BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = com.stylefeng.guns.common.constant.Dict.DictMap)
@RequestMapping(value = "/update") @RequestMapping(value = "/update")
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
...@@ -129,11 +130,15 @@ public class DictController extends BaseController { ...@@ -129,11 +130,15 @@ public class DictController extends BaseController {
/** /**
* 删除字典记录 * 删除字典记录
*/ */
@BussinessLog(value = "删除字典记录", key = "dictId", dict = "DictMap") @BussinessLog(value = "删除字典记录", key = "dictId", dict = com.stylefeng.guns.common.constant.Dict.DeleteDict)
@RequestMapping(value = "/delete") @RequestMapping(value = "/delete")
@Permission(Const.ADMIN_NAME) @Permission(Const.ADMIN_NAME)
@ResponseBody @ResponseBody
public Object delete(@RequestParam Integer dictId) { public Object delete(@RequestParam Integer dictId) {
//缓存被删除的名称
LogObjectHolder.me().set(ConstantFactory.me().getDictName(dictId));
this.dictService.delteDict(dictId); this.dictService.delteDict(dictId);
return SUCCESS_TIP; return SUCCESS_TIP;
} }
......
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