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
12e9ee7e
Commit
12e9ee7e
authored
Apr 05, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志模块完善
parent
6129ac35
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
41 deletions
+121
-41
src/main/java/com/stylefeng/guns/common/constant/factory/PageFactory.java
+22
-0
src/main/java/com/stylefeng/guns/common/warpper/BaseControllerWarpper.java
+1
-1
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
+20
-2
src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
+32
-0
src/main/webapp/static/js/common/bootstrap-table-object.js
+26
-25
src/main/webapp/static/modular/system/log/log.js
+20
-13
No files found.
src/main/java/com/stylefeng/guns/common/constant/factory/PageFactory.java
0 → 100644
View file @
12e9ee7e
package
com
.
stylefeng
.
guns
.
common
.
constant
.
factory
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.stylefeng.guns.core.support.HttpKit
;
import
javax.servlet.http.HttpServletRequest
;
/**
* BootStrap Table默认的分页参数创建
*
* @author fengshuonan
* @date 2017-04-05 22:25
*/
public
class
PageFactory
<
T
>
{
public
Page
<
T
>
defaultPage
()
{
HttpServletRequest
request
=
HttpKit
.
getRequest
();
int
limit
=
Integer
.
valueOf
(
request
.
getParameter
(
"limit"
));
int
offset
=
Integer
.
valueOf
(
request
.
getParameter
(
"offset"
));
return
new
Page
<>((
offset
/
limit
+
1
),
limit
);
}
}
src/main/java/com/stylefeng/guns/common/warpper/BaseControllerWarpper.java
View file @
12e9ee7e
...
...
@@ -34,5 +34,5 @@ public abstract class BaseControllerWarpper {
}
}
p
ublic
abstract
void
warpTheMap
(
Map
<
String
,
Object
>
map
);
p
rotected
abstract
void
warpTheMap
(
Map
<
String
,
Object
>
map
);
}
src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
View file @
12e9ee7e
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
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.warpper.LogWarpper
;
import
com.stylefeng.guns.persistence.dao.OperationLogMapper
;
import
org.apache.ibatis.session.RowBounds
;
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.ResponseBody
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* 日志管理的控制器
...
...
@@ -38,6 +44,18 @@ public class LogController extends BaseController {
@RequestMapping
(
"/list"
)
@ResponseBody
public
Object
list
(){
return
operationLogMapper
.
selectPage
(
new
RowBounds
(
10
,
2
),
null
);
Page
<
OperationLog
>
page
=
new
PageFactory
<
OperationLog
>().
defaultPage
();
List
<
Map
<
String
,
Object
>>
operationLogs
=
operationLogMapper
.
selectMapsPage
(
page
,
null
);
page
.
setRecords
((
List
<
OperationLog
>)
new
LogWarpper
(
operationLogs
).
warp
());
return
super
.
packForBT
(
page
);
}
/**
* 查询操作日志详情
*/
@RequestMapping
(
"/detail/{id}"
)
@ResponseBody
public
Object
detail
(
@PathVariable
Integer
id
){
return
operationLogMapper
.
selectById
(
id
);
}
}
src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
0 → 100644
View file @
12e9ee7e
package
com
.
stylefeng
.
guns
.
modular
.
system
.
warpper
;
import
com.stylefeng.guns.common.warpper.BaseControllerWarpper
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
java.util.List
;
import
java.util.Map
;
/**
* 日志列表的包装类
*
* @author fengshuonan
* @date 2017年4月5日22:56:24
*/
public
class
LogWarpper
extends
BaseControllerWarpper
{
public
LogWarpper
(
List
<
Map
<
String
,
Object
>>
list
)
{
super
(
list
);
}
@Override
public
void
warpTheMap
(
Map
<
String
,
Object
>
map
)
{
String
message
=
(
String
)
map
.
get
(
"message"
);
if
(
ToolUtil
.
isNotEmpty
(
message
)
&&
message
.
length
()
>=
100
)
{
message
=
message
.
substring
(
0
,
100
)
+
"..."
;
}
else
{
message
=
null
;
}
map
.
put
(
"message"
,
message
);
}
}
src/main/webapp/static/js/common/bootstrap-table-object.js
View file @
12e9ee7e
...
...
@@ -6,7 +6,7 @@
* @author fengshuonan
*/
(
function
()
{
var
BSTable
=
function
(
bstableId
,
url
,
columns
)
{
var
BSTable
=
function
(
bstableId
,
url
,
columns
)
{
this
.
btInstance
=
null
;
//jquery和BootStrapTable绑定的对象
this
.
bstableId
=
bstableId
;
this
.
url
=
Feng
.
ctxPath
+
url
;
...
...
@@ -22,25 +22,26 @@
/**
* 初始化bootstrap table
*/
init
:
function
()
{
init
:
function
()
{
var
tableId
=
this
.
bstableId
;
this
.
btInstance
=
$
(
'#'
+
tableId
).
bootstrapTable
({
$
(
'#'
+
tableId
).
bootstrapTable
({
contentType
:
"application/x-www-form-urlencoded"
,
url
:
this
.
url
,
//请求地址
method
:
this
.
method
,
//ajax方式,post还是get
ajaxOptions
:
{
//ajax请求的附带参数
data
:
this
.
data
ajaxOptions
:
{
//ajax请求的附带参数
data
:
this
.
data
},
toolbar
:
"#"
+
this
.
toolbarId
,
//顶部工具条
toolbar
:
"#"
+
this
.
toolbarId
,
//顶部工具条
striped
:
true
,
//是否显示行间隔色
cache
:
false
,
//是否使用缓存,默认为true
pagination
:
true
,
//是否显示分页(*)
sortable
:
false
,
//是否启用排序
sortOrder
:
"desc"
,
//排序方式
pageNumber
:
1
,
//初始化加载第一页,默认第一页
pageNumber
:
1
,
//初始化加载第一页,默认第一页
pageSize
:
14
,
//每页的记录行数(*)
pageList
:
[
14
,
50
,
100
],
//可供选择的每页的行数(*)
queryParamsType
:
'limit'
,
//默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
queryParamsType
:
'limit'
,
//默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
sidePagination
:
this
.
paginationType
,
//分页方式:client客户端分页,server服务端分页(*)
search
:
false
,
//是否显示表格搜索,此搜索是客户端搜索,不会进服务端
strictSearch
:
true
,
//设置为 true启用 全匹配搜索,否则为模糊搜索
...
...
@@ -50,14 +51,14 @@
clickToSelect
:
true
,
//是否启用点击选中行
searchOnEnterKey
:
true
,
//设置为 true时,按回车触发搜索方法,否则自动触发搜索方法
columns
:
this
.
columns
,
//列数组
pagination
:
true
,
//是否显示分页条
height
:
this
.
height
,
icons
:
{
refresh
:
'glyphicon-repeat'
,
toggle
:
'glyphicon-list-alt'
,
columns
:
'glyphicon-list'
pagination
:
true
,
//是否显示分页条
height
:
this
.
height
,
icons
:
{
refresh
:
'glyphicon-repeat'
,
toggle
:
'glyphicon-list-alt'
,
columns
:
'glyphicon-list'
},
iconSize
:
'outline'
iconSize
:
'outline'
});
return
this
;
},
...
...
@@ -65,14 +66,14 @@
/**
* 设置分页方式:server 或者 client
*/
setPaginationType
:
function
(
type
)
{
setPaginationType
:
function
(
type
)
{
this
.
paginationType
=
type
;
},
/**
* 设置ajax post请求时候附带的参数
*/
set
:
function
(
key
,
value
)
{
set
:
function
(
key
,
value
)
{
if
(
typeof
key
==
"object"
)
{
for
(
var
i
in
key
)
{
if
(
typeof
i
==
"function"
)
...
...
@@ -88,7 +89,7 @@
/**
* 设置ajax post请求时候附带的参数
*/
setData
:
function
(
data
)
{
setData
:
function
(
data
)
{
this
.
data
=
data
;
return
this
;
},
...
...
@@ -96,7 +97,7 @@
/**
* 清空ajax post请求参数
*/
clear
:
function
()
{
clear
:
function
()
{
this
.
data
=
{};
return
this
;
},
...
...
@@ -108,10 +109,10 @@
* and set {url: newUrl} to change the url.
* To supply query params specific to this request, set {query: {foo: 'bar'}}
*/
refresh
:
function
(
parms
)
{
if
(
typeof
parms
!=
"undefined"
)
{
this
.
btInstance
.
bootstrapTable
(
'refresh'
,
parms
);
}
else
{
refresh
:
function
(
parms
)
{
if
(
typeof
parms
!=
"undefined"
)
{
this
.
btInstance
.
bootstrapTable
(
'refresh'
,
parms
);
}
else
{
this
.
btInstance
.
bootstrapTable
(
'refresh'
);
}
}
...
...
@@ -119,4 +120,4 @@
window
.
BSTable
=
BSTable
;
}
());
\ No newline at end of file
}());
\ No newline at end of file
src/main/webapp/static/modular/system/log/log.js
View file @
12e9ee7e
...
...
@@ -2,16 +2,16 @@
* 日志管理初始化
*/
var
OptLog
=
{
id
:
"OptLogTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
id
:
"OptLogTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
};
/**
* 初始化表格的列
*/
OptLog
.
initColumn
=
function
()
{
OptLog
.
initColumn
=
function
()
{
return
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'id'
,
field
:
'id'
,
visible
:
false
,
align
:
'center'
,
valign
:
'middle'
},
...
...
@@ -27,7 +27,7 @@ OptLog.initColumn = function(){
/**
* 绑定表格的事件
*/
OptLog
.
bindEvent
=
function
()
{
OptLog
.
bindEvent
=
function
()
{
$
(
'#'
+
this
.
id
).
on
(
'click-row.bs.table'
,
function
(
e
,
row
)
{
OptLog
.
seItem
=
row
;
});
...
...
@@ -36,11 +36,11 @@ OptLog.bindEvent = function(){
/**
* 检查是否选中
*/
OptLog
.
check
=
function
()
{
if
(
this
.
seItem
==
null
)
{
OptLog
.
check
=
function
()
{
if
(
this
.
seItem
==
null
)
{
Feng
.
info
(
"请先选中表格中的某一记录!"
);
return
false
;
}
else
{
}
else
{
return
true
;
}
};
...
...
@@ -48,14 +48,21 @@ OptLog.check = function(){
/**
* 查看日志详情
*/
OptLog
.
detail
=
function
(){
OptLog
.
detail
=
function
()
{
if
(
this
.
check
())
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/log/detail/"
+
this
.
seItem
.
id
,
function
(
data
)
{
},
function
(
data
)
{
});
ajax
.
start
();
}
};
$
(
function
()
{
$
(
function
()
{
var
defaultColunms
=
OptLog
.
initColumn
();
var
table
=
new
BSTable
(
OptLog
.
id
,
"/log/list"
,
defaultColunms
);
table
.
setPaginationType
(
"
client
"
);
var
table
=
new
BSTable
(
OptLog
.
id
,
"/log/list"
,
defaultColunms
);
table
.
setPaginationType
(
"
server
"
);
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