Commit 1ee3b471 by fsn

新增通知管理的日志

parent 49f6587c
...@@ -38,4 +38,9 @@ public interface Dict { ...@@ -38,4 +38,9 @@ public interface Dict {
*/ */
String DictMap = "DictMap"; String DictMap = "DictMap";
/**
* 通知管理业务的字典
*/
String NoticeMap = "NoticeMap";
} }
...@@ -16,6 +16,7 @@ public class DeleteDict extends AbstractDictMap { ...@@ -16,6 +16,7 @@ public class DeleteDict extends AbstractDictMap {
put("deptId", "部门名称"); put("deptId", "部门名称");
put("menuId", "菜单名称"); put("menuId", "菜单名称");
put("dictId", "字典名称"); put("dictId", "字典名称");
put("noticeId", "通知名称");
} }
@Override @Override
...@@ -24,6 +25,7 @@ public class DeleteDict extends AbstractDictMap { ...@@ -24,6 +25,7 @@ public class DeleteDict extends AbstractDictMap {
putFieldWrapperMethodName("deptId","getCacheObject"); putFieldWrapperMethodName("deptId","getCacheObject");
putFieldWrapperMethodName("menuId","getCacheObject"); putFieldWrapperMethodName("menuId","getCacheObject");
putFieldWrapperMethodName("dictId","getCacheObject"); putFieldWrapperMethodName("dictId","getCacheObject");
putFieldWrapperMethodName("noticeId","getCacheObject");
} }
} }
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 NoticeMap extends AbstractDictMap {
@Override
public void init() {
put("title", "标题");
put("content", "内容");
}
@Override
protected void initBeWrapped() {
}
}
...@@ -34,6 +34,7 @@ public class ConstantFactory { ...@@ -34,6 +34,7 @@ public class ConstantFactory {
private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class); private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class);
private UserMapper userMapper = SpringContextHolder.getBean(UserMapper.class); private UserMapper userMapper = SpringContextHolder.getBean(UserMapper.class);
private MenuMapper menuMapper = SpringContextHolder.getBean(MenuMapper.class); private MenuMapper menuMapper = SpringContextHolder.getBean(MenuMapper.class);
private NoticeMapper noticeMapper = SpringContextHolder.getBean(NoticeMapper.class);
public static ConstantFactory me() { public static ConstantFactory me() {
return SpringContextHolder.getBean("constantFactory"); return SpringContextHolder.getBean("constantFactory");
...@@ -175,6 +176,22 @@ public class ConstantFactory { ...@@ -175,6 +176,22 @@ public class ConstantFactory {
} }
/** /**
* 获取通知标题
*/
public String getNoticeTitle(Integer dictId){
if (ToolUtil.isEmpty(dictId)) {
return "";
} else {
Notice notice = noticeMapper.selectById(dictId);
if (notice == null) {
return "";
} else {
return notice.getTitle();
}
}
}
/**
* 获取性别名称 * 获取性别名称
*/ */
public String getSexName(Integer sex) { public String getSexName(Integer sex) {
......
package com.stylefeng.guns.modular.system.controller; package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.annotion.log.BussinessLog;
import com.stylefeng.guns.common.constant.Dict;
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;
import com.stylefeng.guns.core.log.LogObjectHolder;
import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.NoticeDao; import com.stylefeng.guns.modular.system.dao.NoticeDao;
...@@ -10,11 +14,11 @@ import com.stylefeng.guns.modular.system.warpper.NoticeWrapper; ...@@ -10,11 +14,11 @@ import com.stylefeng.guns.modular.system.warpper.NoticeWrapper;
import com.stylefeng.guns.persistence.dao.NoticeMapper; import com.stylefeng.guns.persistence.dao.NoticeMapper;
import com.stylefeng.guns.persistence.model.Notice; import com.stylefeng.guns.persistence.model.Notice;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
...@@ -90,6 +94,7 @@ public class NoticeController extends BaseController { ...@@ -90,6 +94,7 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@ResponseBody @ResponseBody
@BussinessLog(value = "新增通知",key = "title",dict = Dict.NoticeMap)
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);
...@@ -105,8 +110,14 @@ public class NoticeController extends BaseController { ...@@ -105,8 +110,14 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping(value = "/delete") @RequestMapping(value = "/delete")
@ResponseBody @ResponseBody
@BussinessLog(value = "删除通知",key = "noticeId",dict = Dict.DeleteDict)
public Object delete(@RequestParam Integer noticeId) { public Object delete(@RequestParam Integer noticeId) {
//缓存通知名称
LogObjectHolder.me().set(ConstantFactory.me().getNoticeTitle(noticeId));
this.noticeMapper.deleteById(noticeId); this.noticeMapper.deleteById(noticeId);
return SUCCESS_TIP; return SUCCESS_TIP;
} }
...@@ -115,6 +126,7 @@ public class NoticeController extends BaseController { ...@@ -115,6 +126,7 @@ public class NoticeController extends BaseController {
*/ */
@RequestMapping(value = "/update") @RequestMapping(value = "/update")
@ResponseBody @ResponseBody
@BussinessLog(value = "修改通知",key = "title",dict = Dict.NoticeMap)
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);
......
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