资源简介
ssm脚手架工程,包含登录、角色、菜单、权限管理功能、系统日志等功能,采用jdk1.7 +tomacat7+easyUI,适合新手做练习、学习使用。。。。也可以直接做后台管理系统脚手架项目直接操作
代码片段和文件信息
package com.ischoolbar.programmer.controller.admin;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.ischoolbar.programmer.entity.admin.Log;
import com.ischoolbar.programmer.page.admin.Page;
import com.ischoolbar.programmer.service.admin.LogService;
/**
* 日志管理控制器
* @author llq
*
*/
@RequestMapping(“/admin/log“)
@Controller
public class LogController {
@Autowired
private LogService logService;
/**
* 日志列表页面
* @param model
* @return
*/
@RequestMapping(value=“/list“method=RequestMethod.GET)
public ModelAndView list(ModelAndView model){
model.setViewName(“log/list“);
return model;
}
/**
* 获取日志列表
* @param page
* @param content
* @param roleId
* @param sex
* @return
*/
@RequestMapping(value=“/list“method=RequestMethod.POST)
@ResponseBody
public Mapject> getList(Page page
@RequestParam(name=“content“required=falsedefaultValue=““) String content
){
Mapject> ret = new HashMapject>();
Mapject> queryMap = new HashMapject>();
queryMap.put(“content“ content);
queryMap.put(“offset“ page.getOffset());
queryMap.put(“pageSize“ page.getRows());
ret.put(“rows“ logService.findList(queryMap));
ret.put(“total“ logService.getTotal(queryMap));
return ret;
}
/**
* 添加日志
* @param user
* @return
*/
@RequestMapping(value=“/add“method=RequestMethod.POST)
@ResponseBody
public Map add(Log log){
Map ret = new HashMap();
if(log == null){
ret.put(“type“ “error“);
ret.put(“msg“ “请填写正确的日志信息!“);
return ret;
}
if(StringUtils.isEmpty(log.getContent())){
ret.put(“type“ “error“);
ret.put(“msg“ “请填写日志内容!“);
return ret;
}
log.setCreateTime(new Date());
if(logService.add(log) <= 0){
ret.put(“type“ “error“);
ret.put(“msg“ “日志添加失败,请联系管理员!“);
return ret;
}
ret.put(“type“ “success“);
ret.put(“msg“ “日志添加成功!“);
return ret;
}
/**
* 批量删除日志
* @param ids
* @return
*/
@RequestMapping(value=“/delete“method=RequestMethod.POST)
@ResponseBody
public Map delete(String ids){
Map ret = new HashMap();
if(StringUtils.isEmpty(ids)){
ret.put(“type“ “error“);
ret.put(“msg“ “选择要删除的数据!“);
return ret;
}
if(ids.contains(““)){
ids = ids.substring(0ids.length()-1);
}
if(logService.de
评论
共有 条评论