Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
f975aee9
Commit
f975aee9
authored
Apr 05, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志模块添加
parent
fff30474
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
145 additions
and
6 deletions
+145
-6
pom.xml
+1
-1
src/main/java/com/stylefeng/guns/core/aop/GlobalExceptionHandler.java
+3
-1
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
+43
-0
src/main/java/project/config/datasource/DataSourceConfig.java
+0
-1
src/main/java/project/generator/MpGenerator.java
+1
-3
src/main/webapp/WEB-INF/view/system/log/log.html
+35
-0
src/main/webapp/static/modular/system/log/log.js
+62
-0
No files found.
pom.xml
View file @
f975aee9
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
<dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus
</artifactId>
<artifactId>
mybatis-plus
</artifactId>
<version>
2.0.
2
</version>
<version>
2.0.
5
</version>
</dependency>
</dependency>
<!--END-->
<!--END-->
...
...
src/main/java/com/stylefeng/guns/core/aop/GlobalExceptionHandler.java
View file @
f975aee9
...
@@ -42,6 +42,7 @@ public class GlobalExceptionHandler {
...
@@ -42,6 +42,7 @@ public class GlobalExceptionHandler {
public
ErrorTip
notFount
(
BussinessException
e
)
{
public
ErrorTip
notFount
(
BussinessException
e
)
{
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
exceptionLog
(
ShiroKit
.
getUser
().
getId
(),
e
));
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
exceptionLog
(
ShiroKit
.
getUser
().
getId
(),
e
));
getRequest
().
setAttribute
(
"tip"
,
e
.
getMessage
());
getRequest
().
setAttribute
(
"tip"
,
e
.
getMessage
());
log
.
error
(
"业务异常:"
,
e
);
return
new
ErrorTip
(
e
.
getCode
(),
e
.
getMessage
());
return
new
ErrorTip
(
e
.
getCode
(),
e
.
getMessage
());
}
}
...
@@ -56,11 +57,12 @@ public class GlobalExceptionHandler {
...
@@ -56,11 +57,12 @@ public class GlobalExceptionHandler {
public
ErrorTip
notFount
(
RuntimeException
e
)
{
public
ErrorTip
notFount
(
RuntimeException
e
)
{
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
exceptionLog
(
ShiroKit
.
getUser
().
getId
(),
e
));
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
exceptionLog
(
ShiroKit
.
getUser
().
getId
(),
e
));
getRequest
().
setAttribute
(
"tip"
,
"服务器未知运行时异常"
);
getRequest
().
setAttribute
(
"tip"
,
"服务器未知运行时异常"
);
log
.
error
(
"运行时异常:"
,
e
);
return
new
ErrorTip
(
BizExceptionEnum
.
SERVER_ERROR
);
return
new
ErrorTip
(
BizExceptionEnum
.
SERVER_ERROR
);
}
}
/**
/**
*
拦截未知的运行时异常
*
用户未登录
*
*
* @author fengshuonan
* @author fengshuonan
*/
*/
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
0 → 100644
View file @
f975aee9
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
);
}
}
src/main/java/project/config/datasource/DataSourceConfig.java
View file @
f975aee9
...
@@ -12,7 +12,6 @@ import org.springframework.context.annotation.Import;
...
@@ -12,7 +12,6 @@ import org.springframework.context.annotation.Import;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
...
...
src/main/java/project/generator/MpGenerator.java
View file @
f975aee9
...
@@ -60,9 +60,7 @@ public class MpGenerator {
...
@@ -60,9 +60,7 @@ public class MpGenerator {
// 策略配置
// 策略配置
StrategyConfig
strategy
=
new
StrategyConfig
();
StrategyConfig
strategy
=
new
StrategyConfig
();
strategy
.
setTablePrefix
(
new
String
[]{
"_"
});
// 此处可以修改为您的表前缀
strategy
.
setTablePrefix
(
new
String
[]{
"_"
});
// 此处可以修改为您的表前缀
strategy
.
setNaming
(
NamingStrategy
.
remove_prefix_and_camel
);
// 表名生成策略
strategy
.
setNaming
(
NamingStrategy
.
underline_to_camel
);
// 表名生成策略
// 字段名生成策略
strategy
.
setFieldNaming
(
NamingStrategy
.
nochange
);
mpg
.
setStrategy
(
strategy
);
mpg
.
setStrategy
(
strategy
);
// 包配置
// 包配置
...
...
src/main/webapp/WEB-INF/view/system/log/log.html
0 → 100644
View file @
f975aee9
@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>
查看详情
</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>
@}
src/main/webapp/static/modular/system/log/log.js
0 → 100644
View file @
f975aee9
/**
* 日志管理初始化
*/
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
;
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment