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
c63b99e4
Commit
c63b99e4
authored
Apr 28, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录日志的新增
parent
f20fee94
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
188 additions
and
2 deletions
+188
-2
src/main/java/com/stylefeng/guns/modular/system/controller/LoginLogController.java
+63
-0
src/main/java/com/stylefeng/guns/modular/system/dao/LogDao.java
+7
-0
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/LogDao.xml
+11
-0
src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
+1
-1
src/main/webapp/WEB-INF/view/system/log/log.html
+1
-1
src/main/webapp/WEB-INF/view/system/log/login_log.html
+36
-0
src/main/webapp/static/modular/system/log/login_log.js
+69
-0
No files found.
src/main/java/com/stylefeng/guns/modular/system/controller/LoginLogController.java
0 → 100644
View file @
c63b99e4
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.baomidou.mybatisplus.mapper.SqlRunner
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.stylefeng.guns.common.constant.factory.PageFactory
;
import
com.stylefeng.guns.common.controller.BaseController
;
import
com.stylefeng.guns.modular.system.dao.LogDao
;
import
com.stylefeng.guns.modular.system.warpper.LogWarpper
;
import
com.stylefeng.guns.persistence.model.OperationLog
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* 日志管理的控制器
*
* @author fengshuonan
* @Date 2017年4月5日 19:45:36
*/
@Controller
@RequestMapping
(
"/loginLog"
)
public
class
LoginLogController
extends
BaseController
{
private
static
String
PREFIX
=
"/system/log/"
;
@Resource
private
LogDao
logDao
;
/**
* 跳转到日志管理的首页
*/
@RequestMapping
(
""
)
public
String
index
()
{
return
PREFIX
+
"login_log.html"
;
}
/**
* 查询操作日志列表
*/
@RequestMapping
(
"/list"
)
@ResponseBody
public
Object
list
(
@RequestParam
(
required
=
false
)
String
beginTime
,
@RequestParam
(
required
=
false
)
String
endTime
,
@RequestParam
(
required
=
false
)
String
logName
)
{
Page
<
OperationLog
>
page
=
new
PageFactory
<
OperationLog
>().
defaultPage
();
List
<
Map
<
String
,
Object
>>
result
=
logDao
.
getLoginLogs
(
page
,
beginTime
,
endTime
,
logName
);
page
.
setRecords
((
List
<
OperationLog
>)
new
LogWarpper
(
result
).
warp
());
return
super
.
packForBT
(
page
);
}
/**
* 清空日志
*/
@RequestMapping
(
"/delLoginLog"
)
@ResponseBody
public
Object
delLog
()
{
SqlRunner
.
db
().
delete
(
"delete from _login_log"
);
return
super
.
SUCCESS_TIP
;
}
}
src/main/java/com/stylefeng/guns/modular/system/dao/LogDao.java
View file @
c63b99e4
...
...
@@ -23,4 +23,11 @@ public interface LogDao{
*/
List
<
Map
<
String
,
Object
>>
getOperationLogs
(
Page
<
OperationLog
>
page
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"logName"
)
String
logName
);
/**
* 获取登录日志
*
* @author stylefeng
* @Date 2017/4/16 23:48
*/
List
<
Map
<
String
,
Object
>>
getLoginLogs
(
Page
<
OperationLog
>
page
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"logName"
)
String
logName
);
}
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/LogDao.xml
View file @
c63b99e4
...
...
@@ -13,4 +13,14 @@
order by createTime DESC
</select>
<select
id=
"getLoginLogs"
resultType=
"map"
>
select * from _login_log where 1 = 1
<if
test=
"beginTime != null and beginTime !='' and endTime != null and endTime != ''"
>
and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
</if>
<if
test=
"logName != null and logName !=''"
>
and logname like CONCAT('%',#{logName},'%')
</if>
order by createTime DESC
</select>
</mapper>
\ No newline at end of file
src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
View file @
c63b99e4
...
...
@@ -29,7 +29,7 @@ public class LogWarpper extends BaseControllerWarpper {
}
//如果信息中包含分割符号;;; 则分割字符串返给前台
if
(
message
.
indexOf
(
Contrast
.
separator
)
!=
-
1
)
{
if
(
ToolUtil
.
isNotEmpty
(
message
)
&&
message
.
indexOf
(
Contrast
.
separator
)
!=
-
1
)
{
String
[]
msgs
=
message
.
split
(
Contrast
.
separator
);
map
.
put
(
"regularMessage"
,
msgs
);
}
else
{
...
...
src/main/webapp/WEB-INF/view/system/log/log.html
View file @
c63b99e4
...
...
@@ -3,7 +3,7 @@
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
日志管理
</h5>
<h5>
业务日志
</h5>
</div>
<div
class=
"ibox-content"
>
<div
class=
"row row-lg"
>
...
...
src/main/webapp/WEB-INF/view/system/log/login_log.html
0 → 100644
View file @
c63b99e4
@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=
"row"
>
<div
class=
"col-sm-3"
>
<
#
TimeCon
id=
"beginTime"
name=
"开始时间"
isTime=
"false"
pattern=
"YYYY-MM-DD"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
TimeCon
id=
"endTime"
name=
"结束时间"
isTime=
"false"
pattern=
"YYYY-MM-DD"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
NameCon
id=
"logName"
name=
"日志名称"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"LoginLog.search()"
/>
</div>
</div>
<div
class=
"hidden-xs"
id=
"LoginLogTableToolbar"
role=
"group"
>
<
#
button
name=
"清空日志"
icon=
"fa-plus"
clickFun=
"LoginLog.delLog()"
/>
</div>
<
#
table
id=
"LoginLogTable"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/system/log/login_log.js"
></script>
@}
src/main/webapp/static/modular/system/log/login_log.js
0 → 100644
View file @
c63b99e4
/**
* 日志管理初始化
*/
var
LoginLog
=
{
id
:
"LoginLogTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
};
/**
* 初始化表格的列
*/
LoginLog
.
initColumn
=
function
()
{
return
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'id'
,
field
:
'id'
,
visible
:
false
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'日志名称'
,
field
:
'logname'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'用户id'
,
field
:
'userid'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'时间'
,
field
:
'createtime'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'具体消息'
,
field
:
'message'
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'ip'
,
field
:
'ip'
,
align
:
'center'
,
valign
:
'middle'
}];
};
/**
* 检查是否选中
*/
LoginLog
.
check
=
function
()
{
var
selected
=
$
(
'#'
+
this
.
id
).
bootstrapTable
(
'getSelections'
);
if
(
selected
.
length
==
0
){
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
}
else
{
LoginLog
.
seItem
=
selected
[
0
];
return
true
;
}
};
/**
* 清空日志
*/
LoginLog
.
delLog
=
function
()
{
Feng
.
confirm
(
"是否清空所有日志?"
,
function
(){
var
ajax
=
Feng
.
baseAjax
(
"/loginLog/delLoginLog"
,
"清空日志"
);
ajax
.
start
();
LoginLog
.
table
.
refresh
();
});
}
/**
* 查询日志列表
*/
LoginLog
.
search
=
function
()
{
var
queryData
=
{};
queryData
[
'logName'
]
=
$
(
"#logName"
).
val
();
queryData
[
'beginTime'
]
=
$
(
"#beginTime"
).
val
();
queryData
[
'endTime'
]
=
$
(
"#endTime"
).
val
();
LoginLog
.
table
.
refresh
({
query
:
queryData
});
};
$
(
function
()
{
var
defaultColunms
=
LoginLog
.
initColumn
();
var
table
=
new
BSTable
(
LoginLog
.
id
,
"/loginLog/list"
,
defaultColunms
);
table
.
setPaginationType
(
"server"
);
LoginLog
.
table
=
table
.
init
();
});
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