1
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package com.yunhai.bschclassmanage.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 系统审计日志实体(双轨之审计轨)。
|
||||
* 与业务日志实体 OperationLogRecord / 表 operation_log 物理隔离、互不融合。
|
||||
* 索引由 sqlscript/sys_operation_log.sql 负责创建,本实体不含 @Table(indexes),
|
||||
* 避免 ddl-auto=update 启动时重复建索引告警。
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_operation_log")
|
||||
public class SysOperationLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/** 1-重要(删除) 2-次要(新增/编辑) 3-一般(查询) */
|
||||
@Column(name = "log_level", nullable = false, columnDefinition = "TINYINT")
|
||||
private Integer logLevel;
|
||||
|
||||
@Column(name = "operation_type", nullable = false, length = 16)
|
||||
private String operationType; // DELETE/CREATE/UPDATE/QUERY
|
||||
|
||||
@Column(name = "user_id")
|
||||
private Integer userId; // 来自 UserContext.getUserId()
|
||||
|
||||
@Column(name = "user_name", length = 64)
|
||||
private String userName; // 来自 UserContext.getUserName()
|
||||
|
||||
@Column(name = "sch_id")
|
||||
private Integer schId; // 多校隔离,来自 UserContext.getSchId()
|
||||
|
||||
@Column(name = "request_ip", nullable = false, length = 64)
|
||||
private String requestIp; // 客户端IP
|
||||
|
||||
@Column(name = "request_uri", nullable = false, length = 512)
|
||||
private String requestUri;
|
||||
|
||||
@Column(name = "request_method", nullable = false, length = 16)
|
||||
private String requestMethod;
|
||||
|
||||
@Column(name = "class_method", nullable = false, length = 512)
|
||||
private String classMethod;
|
||||
|
||||
@Column(name = "request_params", columnDefinition = "TEXT")
|
||||
private String requestParams; // 脱敏后
|
||||
|
||||
@Column(name = "response_data", columnDefinition = "MEDIUMBLOB")
|
||||
private byte[] responseData; // GZIP 压缩后的响应 JSON
|
||||
|
||||
@Column(name = "status_code", nullable = false)
|
||||
private Integer statusCode; // 200 成功 / 500 异常
|
||||
|
||||
@Column(name = "cost_time", nullable = false)
|
||||
private Long costTime; // ms
|
||||
|
||||
@Column(name = "user_agent", length = 512)
|
||||
private String userAgent;
|
||||
|
||||
@Column(name = "error_msg", columnDefinition = "TEXT")
|
||||
private String errorMsg; // 异常信息,截断 2000
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time", nullable = false, updatable = false, columnDefinition = "DATETIME(3)")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
Reference in New Issue
Block a user