Commit f975aee9 by fsn

日志模块添加

parent fff30474
......@@ -66,7 +66,7 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.0.2</version>
<version>2.0.5</version>
</dependency>
<!--END-->
......
......@@ -42,6 +42,7 @@ public class GlobalExceptionHandler {
public ErrorTip notFount(BussinessException e) {
LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e));
getRequest().setAttribute("tip", e.getMessage());
log.error("业务异常:",e);
return new ErrorTip(e.getCode(), e.getMessage());
}
......@@ -56,11 +57,12 @@ public class GlobalExceptionHandler {
public ErrorTip notFount(RuntimeException e) {
LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e));
getRequest().setAttribute("tip", "服务器未知运行时异常");
log.error("运行时异常:",e);
return new ErrorTip(BizExceptionEnum.SERVER_ERROR);
}
/**
* 拦截未知的运行时异常
* 用户未登录
*
* @author fengshuonan
*/
......
package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.persistence.dao.OperationLogMapper;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* 日志管理的控制器
*
* @author fengshuonan
* @Date 2017年4月5日 19:45:36
*/
@Controller
@RequestMapping("/log")
public class LogController extends BaseController {
private static String PREFIX = "/system/log/";
@Resource
private OperationLogMapper operationLogMapper;
/**
* 跳转到日志管理的首页
*/
@RequestMapping("")
public String index() {
return PREFIX + "log.html";
}
/**
* 查询操作日志列表
*/
@RequestMapping("/list")
@ResponseBody
public Object list(){
return operationLogMapper.selectPage(new RowBounds(10,2), null);
}
}
......@@ -12,7 +12,6 @@ import org.springframework.context.annotation.Import;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
......
......@@ -60,9 +60,7 @@ public class MpGenerator {
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setTablePrefix(new String[]{"_"});// 此处可以修改为您的表前缀
strategy.setNaming(NamingStrategy.remove_prefix_and_camel);// 表名生成策略
// 字段名生成策略
strategy.setFieldNaming(NamingStrategy.nochange);
strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
mpg.setStrategy(strategy);
// 包配置
......
@layout("/common/_container.html"){
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>日志管理</h5>
</div>
<div class="ibox-content">
<div class="row row-lg">
<div class="col-sm-12">
<!-- 成员列表 -->
<div class="example-wrap">
<div class="example">
<div class="hidden-xs" id="LogTableToolbar" role="group">
<button type="button" class="btn btn-primary" onclick="OptLog.detail()"><i class="fa fa-plus"></i>&nbsp;查看详情</button>
</div>
<table id="LogTable" data-mobile-responsive="true"
data-click-to-select="true">
<thead>
<tr>
<th data-field="selectItem" data-checkbox="true"></th>
</tr>
</thead>
</table>
</div>
</div>
<!-- End 成员列表 -->
</div>
</div>
</div>
</div>
</div>
</div>
<script src="${ctxPath}/static/modular/system/log/log.js"></script>
@}
/**
* 日志管理初始化
*/
var OptLog = {
id : "logTable", //表格id
seItem : null, //选中的条目
table : null,
layerIndex : -1
};
/**
* 初始化表格的列
*/
OptLog.initColumn = function(){
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '日志类型', field: 'logtype', align: 'center', valign: 'middle'},
{title: '日志名称', field: 'logname', align: 'center', valign: 'middle'},
{title: '用户id', field: 'userid', align: 'center', valign: 'middle'},
{title: '类名', field: 'classname', align: 'center', valign: 'middle'},
{title: '方法名', field: 'method', align: 'center', valign: 'middle'},
{title: '时间', field: 'createtime', align: 'center', valign: 'middle'},
{title: '具体消息', field: 'message', align: 'center', valign: 'middle'}];
};
/**
* 绑定表格的事件
*/
OptLog.bindEvent = function(){
$('#' + this.id).on('click-row.bs.table', function (e, row) {
OptLog.seItem = row;
});
};
/**
* 检查是否选中
*/
OptLog.check = function(){
if(this.seItem == null){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
return true;
}
};
/**
* 查看日志详情
*/
OptLog.detail = function(){
};
$(function(){
var defaultColunms = OptLog.initColumn();
var table = new BSTable(OptLog.id,"/log/list",defaultColunms);
table.setPaginationType("client");
table.init();
OptLog.bindEvent();
OptLog.table = table;
});
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