Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
16270ae8
Commit
16270ae8
authored
Sep 20, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
操作日志新增返回参数
parent
64f0e9d2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
12 deletions
+40
-12
ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html
+14
-4
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
+7
-5
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
+14
-0
ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
+4
-3
sql/ry_20190920.sql
+1
-0
No files found.
ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html
View file @
16270ae8
...
...
@@ -37,6 +37,10 @@
<div
class=
"form-control-static"
><pre
id=
"operParam"
></pre></div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
返回参数:
</label>
<div
class=
"form-control-static"
><pre
id=
"jsonResult"
></pre></div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
状态:
</label>
<div
class=
"form-control-static"
th:class=
"${operLog.status == 0 ? 'label label-primary' : 'label label-danger'}"
th:text=
"${operLog.status == 0 ? '正常' : '异常'}"
>
</div>
...
...
@@ -52,11 +56,17 @@
<th:block
th:include=
"include :: jsonview-js"
/>
<script
th:inline=
"javascript"
>
$
(
function
()
{
var
json
=
[[
$
{
operLog
.
operParam
}]];
if
(
$
.
common
.
isNotEmpty
(
json
)
&&
json
.
length
<
2000
)
{
$
(
"#operParam"
).
JSONView
(
json
);
var
operParam
=
[[
$
{
operLog
.
operParam
}]];
if
(
$
.
common
.
isNotEmpty
(
operParam
)
&&
operParam
.
length
<
2000
)
{
$
(
"#operParam"
).
JSONView
(
operParam
);
}
else
{
$
(
"#operParam"
).
text
(
operParam
);
}
var
jsonResult
=
[[
$
{
operLog
.
jsonResult
}]];
if
(
$
.
common
.
isNotEmpty
(
jsonResult
)
&&
jsonResult
.
length
<
2000
)
{
$
(
"#jsonResult"
).
JSONView
(
jsonResult
);
}
else
{
$
(
"#
operParam"
).
text
(
json
);
$
(
"#
jsonResult"
).
text
(
jsonResult
);
}
});
</script>
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
View file @
16270ae8
...
...
@@ -45,10 +45,10 @@ public class LogAspect
*
* @param joinPoint 切点
*/
@AfterReturning
(
pointcut
=
"logPointCut()"
)
public
void
doAfterReturning
(
JoinPoint
joinPoint
)
@AfterReturning
(
pointcut
=
"logPointCut()"
,
returning
=
"jsonResult"
)
public
void
doAfterReturning
(
JoinPoint
joinPoint
,
Object
jsonResult
)
{
handleLog
(
joinPoint
,
null
);
handleLog
(
joinPoint
,
null
,
jsonResult
);
}
/**
...
...
@@ -60,10 +60,10 @@ public class LogAspect
@AfterThrowing
(
value
=
"logPointCut()"
,
throwing
=
"e"
)
public
void
doAfterThrowing
(
JoinPoint
joinPoint
,
Exception
e
)
{
handleLog
(
joinPoint
,
e
);
handleLog
(
joinPoint
,
e
,
null
);
}
protected
void
handleLog
(
final
JoinPoint
joinPoint
,
final
Exception
e
)
protected
void
handleLog
(
final
JoinPoint
joinPoint
,
final
Exception
e
,
Object
jsonResult
)
{
try
{
...
...
@@ -83,6 +83,8 @@ public class LogAspect
// 请求的地址
String
ip
=
ShiroUtils
.
getIp
();
operLog
.
setOperIp
(
ip
);
// 返回参数
operLog
.
setJsonResult
(
JSON
.
marshal
(
jsonResult
));
operLog
.
setOperUrl
(
ServletUtils
.
getRequest
().
getRequestURI
());
if
(
currentUser
!=
null
)
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
View file @
16270ae8
...
...
@@ -67,6 +67,10 @@ public class SysOperLog extends BaseEntity
@Excel
(
name
=
"请求参数"
)
private
String
operParam
;
/** 返回参数 */
@Excel
(
name
=
"返回参数"
)
private
String
jsonResult
;
/** 操作状态(0正常 1异常) */
@Excel
(
name
=
"状态"
,
readConverterExp
=
"0=正常,1=异常"
)
private
Integer
status
;
...
...
@@ -209,6 +213,16 @@ public class SysOperLog extends BaseEntity
this
.
operParam
=
operParam
;
}
public
String
getJsonResult
()
{
return
jsonResult
;
}
public
void
setJsonResult
(
String
jsonResult
)
{
this
.
jsonResult
=
jsonResult
;
}
public
Integer
getStatus
()
{
return
status
;
...
...
ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
View file @
16270ae8
...
...
@@ -17,19 +17,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"operIp"
column=
"oper_ip"
/>
<result
property=
"operLocation"
column=
"oper_location"
/>
<result
property=
"operParam"
column=
"oper_param"
/>
<result
property=
"jsonResult"
column=
"json_result"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"errorMsg"
column=
"error_msg"
/>
<result
property=
"operTime"
column=
"oper_time"
/>
</resultMap>
<sql
id=
"selectOperLogVo"
>
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param,
json_result,
status, error_msg, oper_time
from sys_oper_log
</sql>
<insert
id=
"insertOperlog"
parameterType=
"SysOperLog"
>
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate())
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param,
json_result,
status, error_msg, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{
jsonResult}, #{
status}, #{errorMsg}, sysdate())
</insert>
<select
id=
"selectOperLogList"
parameterType=
"SysOperLog"
resultMap=
"SysOperLogResult"
>
...
...
sql/ry_20190
822
.sql
→
sql/ry_20190
920
.sql
View file @
16270ae8
...
...
@@ -416,6 +416,7 @@ create table sys_oper_log (
oper_ip
varchar
(
50
)
default
''
comment
'主机地址'
,
oper_location
varchar
(
255
)
default
''
comment
'操作地点'
,
oper_param
varchar
(
2000
)
default
''
comment
'请求参数'
,
json_result
varchar
(
2000
)
default
''
comment
'返回参数'
,
status
int
(
1
)
default
0
comment
'操作状态(0正常 1异常)'
,
error_msg
varchar
(
2000
)
default
''
comment
'错误消息'
,
oper_time
datetime
comment
'操作时间'
,
...
...
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