feat(syslog): 操作日志和登录日志记录操作人密级

sys_log 新增 user_security_level 列,取值与 sys_user.user_security_level 一致
(字典:3非密/4一般/5重要),LogDTO/SysLog 实体同步补充字段。
This commit is contained in:
wsm
2026-08-05 09:59:38 +08:00
parent e228152fad
commit 20b76afa02
7 changed files with 23 additions and 3 deletions
@@ -61,6 +61,11 @@ public class LogDTO implements Serializable {
*/
private String clientType;
/**
* 操作人密级(3非密,4一般,5重要)
*/
private Integer userSecurityLevel;
public LogDTO(){
}
@@ -107,6 +107,7 @@ public class AutoLogAspect {
if(sysUser!=null){
dto.setUserid(sysUser.getUsername());
dto.setUsername(sysUser.getRealname());
dto.setUserSecurityLevel(sysUser.getUserSecurityLevel());
}
//耗时
dto.setCostTime(time);
@@ -4,7 +4,7 @@
<!-- 保存日志11 -->
<insert id="saveLog" parameterType="Object">
insert into sys_log (id, log_type, log_content, method, operate_type, request_url, request_type, request_param, ip, userid, username, cost_time, create_time,create_by, tenant_id, client_type)
insert into sys_log (id, log_type, log_content, method, operate_type, request_url, request_type, request_param, ip, userid, username, cost_time, create_time,create_by, tenant_id, client_type, user_security_level)
values(
#{dto.id,jdbcType=VARCHAR},
#{dto.logType,jdbcType=INTEGER},
@@ -21,7 +21,8 @@
#{dto.createTime,jdbcType=TIMESTAMP},
#{dto.createBy,jdbcType=VARCHAR},
#{dto.tenantId,jdbcType=INTEGER},
#{dto.clientType,jdbcType=VARCHAR}
#{dto.clientType,jdbcType=VARCHAR},
#{dto.userSecurityLevel,jdbcType=INTEGER}
)
</insert>
@@ -82,6 +82,7 @@ public class BaseCommonServiceImpl implements BaseCommonService {
if(user!=null){
sysLog.setUserid(user.getUsername());
sysLog.setUsername(user.getRealname());
sysLog.setUserSecurityLevel(user.getUserSecurityLevel());
}
sysLog.setCreateTime(new Date());
//保存日志(异常捕获处理,防止数据太大存储失败,导致业务失败)JT-238
@@ -120,4 +120,9 @@ public class SysLog implements Serializable {
*/
private Integer tenantId;
/**
* 操作人密级(3非密,4一般,5重要)
*/
private Integer userSecurityLevel;
}
+1
View File
@@ -23,6 +23,7 @@ YYYYMMDD_描述.sql
|------|------|------|------|
| 2026-07-09 | DML | `20260709_新增督办状态字典.sql` | 新增 super_status 字典(未开始/督办中/已完成) |
| 2026-07-09 | DML | `20260709_新增反馈任务状态字典.sql` | 新增 feedback_status 字典(未开始/进行中/已完成) |
| 2026-08-05 | DDL | `20260805_系统日志表新增操作人密级字段.sql` | sys_log 新增 user_security_level 列,记录操作人密级 |
## 使用方式
@@ -0,0 +1,6 @@
-- 系统日志表新增操作人密级字段
-- 记录操作日志/登录日志时,带上操作人密级,取值与 sys_user.user_security_level 一致
-- 字典:user_security_level3非密,4一般,5重要)
-- 变更日期:2026-08-05
ALTER TABLE `sys_log`
ADD COLUMN `user_security_level` tinyint(1) NULL DEFAULT NULL COMMENT '操作人密级(3非密,4一般,5重要)' AFTER `client_type`;