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
6569f807
Commit
6569f807
authored
Apr 17, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成日志管理根据条件查询
parent
2bd22986
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
7 deletions
+53
-7
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
+10
-6
src/main/java/com/stylefeng/guns/modular/system/dao/LogDao.java
+26
-0
src/main/java/com/stylefeng/guns/modular/system/dao/mapping/LogDao.xml
+16
-0
src/main/webapp/WEB-INF/view/system/log/log.html
+1
-1
No files found.
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
View file @
6569f807
...
...
@@ -4,16 +4,17 @@ 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.core.support.BeanKit
;
import
com.stylefeng.guns.modular.system.dao.LogDao
;
import
com.stylefeng.guns.modular.system.warpper.LogWarpper
;
import
com.stylefeng.guns.persistence.dao.OperationLogMapper
;
import
com.stylefeng.guns.persistence.model.OperationLog
;
import
org.springframework.stereotype.Controller
;
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
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -32,6 +33,9 @@ public class LogController extends BaseController {
@Resource
private
OperationLogMapper
operationLogMapper
;
@Resource
private
LogDao
logDao
;
/**
* 跳转到日志管理的首页
*/
...
...
@@ -39,16 +43,16 @@ public class LogController extends BaseController {
public
String
index
()
{
return
PREFIX
+
"log.html"
;
}
/**
* 查询操作日志列表
*/
@RequestMapping
(
"/list"
)
@ResponseBody
public
Object
list
(
Date
beginTime
,
Date
endTime
,
String
logName
)
{
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
>>
operationLogs
=
operationLogMapper
.
selectMapsPage
(
page
,
null
);
page
.
setRecords
((
List
<
OperationLog
>)
new
LogWarpper
(
operationLogs
).
warp
());
List
<
Map
<
String
,
Object
>>
result
=
logDao
.
getOperationLogs
(
page
,
beginTime
,
endTime
,
logName
);
page
.
setRecords
((
List
<
OperationLog
>)
new
LogWarpper
(
result
).
warp
());
return
super
.
packForBT
(
page
);
}
...
...
@@ -57,7 +61,7 @@ public class LogController extends BaseController {
*/
@RequestMapping
(
"/detail/{id}"
)
@ResponseBody
public
Object
detail
(
@PathVariable
Integer
id
){
public
Object
detail
(
@PathVariable
Integer
id
)
{
OperationLog
operationLog
=
operationLogMapper
.
selectById
(
id
);
Map
<
String
,
Object
>
stringObjectMap
=
BeanKit
.
beanToMap
(
operationLog
);
return
super
.
warpObject
(
new
LogWarpper
(
stringObjectMap
));
...
...
src/main/java/com/stylefeng/guns/modular/system/dao/LogDao.java
0 → 100644
View file @
6569f807
package
com
.
stylefeng
.
guns
.
modular
.
system
.
dao
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.stylefeng.guns.persistence.model.OperationLog
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 日志记录dao
*
* @author stylefeng
* @Date 2017/4/16 23:44
*/
public
interface
LogDao
{
/**
* 获取操作日志
*
* @author stylefeng
* @Date 2017/4/16 23:48
*/
List
<
Map
<
String
,
Object
>>
getOperationLogs
(
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
0 → 100644
View file @
6569f807
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.stylefeng.guns.modular.system.dao.LogDao"
>
<select
id=
"getOperationLogs"
resultType=
"map"
>
select * from _operation_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>
</select>
</mapper>
\ No newline at end of file
src/main/webapp/WEB-INF/view/system/log/log.html
View file @
6569f807
...
...
@@ -19,7 +19,7 @@
<
#
NameCon
id=
"logName"
name=
"日志名称"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"search()"
/>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"
OptLog.
search()"
/>
</div>
</div>
<div
class=
"hidden-xs"
id=
"OptLogTableToolbar"
role=
"group"
>
...
...
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