Commit 1ee3b471 by fsn

新增通知管理的日志

parent 49f6587c
......@@ -38,4 +38,9 @@ public interface Dict {
*/
String DictMap = "DictMap";
/**
* 通知管理业务的字典
*/
String NoticeMap = "NoticeMap";
}
......@@ -16,6 +16,7 @@ public class DeleteDict extends AbstractDictMap {
put("deptId", "部门名称");
put("menuId", "菜单名称");
put("dictId", "字典名称");
put("noticeId", "通知名称");
}
@Override
......@@ -24,6 +25,7 @@ public class DeleteDict extends AbstractDictMap {
putFieldWrapperMethodName("deptId","getCacheObject");
putFieldWrapperMethodName("menuId","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 {
private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class);
private UserMapper userMapper = SpringContextHolder.getBean(UserMapper.class);
private MenuMapper menuMapper = SpringContextHolder.getBean(MenuMapper.class);
private NoticeMapper noticeMapper = SpringContextHolder.getBean(NoticeMapper.class);
public static ConstantFactory me() {
return SpringContextHolder.getBean("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) {
......
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.exception.BizExceptionEnum;
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.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.NoticeDao;
......@@ -10,11 +14,11 @@ import com.stylefeng.guns.modular.system.warpper.NoticeWrapper;
import com.stylefeng.guns.persistence.dao.NoticeMapper;
import com.stylefeng.guns.persistence.model.Notice;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import javax.annotation.Resource;
import java.util.Date;
......@@ -90,6 +94,7 @@ public class NoticeController extends BaseController {
*/
@RequestMapping(value = "/add")
@ResponseBody
@BussinessLog(value = "新增通知",key = "title",dict = Dict.NoticeMap)
public Object add(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) {
throw new BussinessException(BizExceptionEnum.REQUEST_NULL);
......@@ -105,8 +110,14 @@ public class NoticeController extends BaseController {
*/
@RequestMapping(value = "/delete")
@ResponseBody
@BussinessLog(value = "删除通知",key = "noticeId",dict = Dict.DeleteDict)
public Object delete(@RequestParam Integer noticeId) {
//缓存通知名称
LogObjectHolder.me().set(ConstantFactory.me().getNoticeTitle(noticeId));
this.noticeMapper.deleteById(noticeId);
return SUCCESS_TIP;
}
......@@ -115,6 +126,7 @@ public class NoticeController extends BaseController {
*/
@RequestMapping(value = "/update")
@ResponseBody
@BussinessLog(value = "修改通知",key = "title",dict = Dict.NoticeMap)
public Object update(Notice notice) {
if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) {
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