diff --git a/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html b/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html index 5781420f..b6411e4e 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html @@ -36,6 +36,10 @@
+
+ +
+
@@ -52,11 +56,17 @@ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 893e9f3e..87a7198b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -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) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java index 07046400..a3a98438 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -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; diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml index a0b52d96..9658e873 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -17,19 +17,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - 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 - 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())