完善日志监控 对参数的监控
This commit is contained in:
parent
facedfd3ea
commit
cd0a00736f
|
@ -124,7 +124,7 @@ public class UserController extends BaseController{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
|
@ApiOperation(value = "/updateUser", httpMethod = "POST", notes = "更新用户")
|
||||||
@Log(desc = "更新用户")
|
@Log(desc = "更新用户",type = LOG_TYPE.UPDATE)
|
||||||
@PostMapping(value = "updateUser")
|
@PostMapping(value = "updateUser")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public JsonUtil updateUser(SysUser user,String role[]) {
|
public JsonUtil updateUser(SysUser user,String role[]) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.len.core.annotation;
|
package com.len.core.annotation;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.len.base.CurrentUser;
|
import com.len.base.CurrentUser;
|
||||||
import com.len.core.shiro.ShiroUtil;
|
import com.len.core.shiro.ShiroUtil;
|
||||||
import com.len.entity.SysLog;
|
import com.len.entity.SysLog;
|
||||||
|
@ -53,6 +54,17 @@ public class LogAspect {
|
||||||
log.setCreateTime(new Date());
|
log.setCreateTime(new Date());
|
||||||
log.setType(type.toString());
|
log.setType(type.toString());
|
||||||
log.setText(text);
|
log.setText(text);
|
||||||
|
|
||||||
|
Object[] obj= jp.getArgs();
|
||||||
|
StringBuffer buffer=new StringBuffer();
|
||||||
|
if(obj!=null){
|
||||||
|
for(int i=0;i<obj.length;i++){
|
||||||
|
buffer.append("[参数"+(i+1)+":");
|
||||||
|
buffer.append(JSON.toJSONString(obj[i]));
|
||||||
|
buffer.append("]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.setParam(buffer.toString());
|
||||||
if(currentUser!=null){
|
if(currentUser!=null){
|
||||||
log.setUserName(currentUser.getUsername());
|
log.setUserName(currentUser.getUsername());
|
||||||
logMapper.insert(log);
|
logMapper.insert(log);
|
||||||
|
|
|
@ -2,7 +2,13 @@ package com.len.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
public class SysLog implements Serializable {
|
public class SysLog implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@ -14,55 +20,9 @@ public class SysLog implements Serializable {
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
private String param;
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
|
||||||
this.userName = userName == null ? null : userName.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIp() {
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIp(String ip) {
|
|
||||||
this.ip = ip == null ? null : ip.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type == null ? null : type.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
|
||||||
this.text = text == null ? null : text.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -123,9 +123,10 @@
|
||||||
, cols: [[
|
, cols: [[
|
||||||
{checkbox: true, fixed: true, width: '5%'}
|
{checkbox: true, fixed: true, width: '5%'}
|
||||||
, {field: 'userName', title: '操作人', width: '10%', sort: true}
|
, {field: 'userName', title: '操作人', width: '10%', sort: true}
|
||||||
, {field: 'type', title: '操作类型', width: '10%', sort: true}
|
, {field: 'type', title: '操作类型', width: '5%', sort: true}
|
||||||
, {field: 'text', title: '描述内容', width: '30%', sort: true}
|
, {field: 'text', title: '描述内容', width: '10%', sort: true}
|
||||||
, {field: 'createTime', title: '操作时间', width: '25%',templet: '<div>{{ layui.laytpl.toDateString(d.createTime,"yyyy-MM-dd HH:mm:ss") }}</div>'}
|
, {field: 'param', title: '参数', width: '45%', sort: true}
|
||||||
|
, {field: 'createTime', title: '操作时间', width: '10%',templet: '<div>{{ layui.laytpl.toDateString(d.createTime,"yyyy-MM-dd HH:mm:ss") }}</div>'}
|
||||||
, {field: 'text', title: '操作', width: '20%', toolbar:'#toolBar'}
|
, {field: 'text', title: '操作', width: '20%', toolbar:'#toolBar'}
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
<result column="ip" jdbcType="VARCHAR" property="ip" />
|
<result column="ip" jdbcType="VARCHAR" property="ip" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="text" jdbcType="VARCHAR" property="text" />
|
<result column="text" jdbcType="VARCHAR" property="text" />
|
||||||
|
<result column="param" jdbcType="VARCHAR" property="param" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, user_name, ip, type, text, create_time
|
id, user_name, ip, type, text, param, create_time
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -24,10 +25,11 @@
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="com.len.entity.SysLog">
|
<insert id="insert" parameterType="com.len.entity.SysLog">
|
||||||
insert into sys_log (id, user_name, ip,
|
insert into sys_log (id, user_name, ip,
|
||||||
type, text, create_time
|
type, text,param,create_time
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR},
|
values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR},
|
||||||
#{type,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
|
#{type,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR},#{param,jdbcType=VARCHAR},
|
||||||
|
#{createTime,jdbcType=TIMESTAMP}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.len.entity.SysLog">
|
<insert id="insertSelective" parameterType="com.len.entity.SysLog">
|
||||||
|
@ -48,6 +50,9 @@
|
||||||
<if test="text != null">
|
<if test="text != null">
|
||||||
text,
|
text,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="text != null">
|
||||||
|
param,
|
||||||
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
|
@ -68,6 +73,9 @@
|
||||||
<if test="text != null">
|
<if test="text != null">
|
||||||
#{text,jdbcType=VARCHAR},
|
#{text,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param != null">
|
||||||
|
#{param,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
|
@ -88,6 +96,9 @@
|
||||||
<if test="text != null">
|
<if test="text != null">
|
||||||
text = #{text,jdbcType=VARCHAR},
|
text = #{text,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param != null">
|
||||||
|
param = #{param,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
|
@ -100,6 +111,7 @@
|
||||||
ip = #{ip,jdbcType=VARCHAR},
|
ip = #{ip,jdbcType=VARCHAR},
|
||||||
type = #{type,jdbcType=VARCHAR},
|
type = #{type,jdbcType=VARCHAR},
|
||||||
text = #{text,jdbcType=VARCHAR},
|
text = #{text,jdbcType=VARCHAR},
|
||||||
|
param = #{param,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
|
Loading…
Reference in New Issue