From 9a5d984a74d5f893fc51366b42391d9b4f8a83ed Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期四, 12 三月 2026 15:40:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/main/java/com/ruoyi/common/config/MybatisHandler.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/ruoyi/common/config/MybatisHandler.java b/src/main/java/com/ruoyi/common/config/MybatisHandler.java
index 2acd7ba..891410f 100644
--- a/src/main/java/com/ruoyi/common/config/MybatisHandler.java
+++ b/src/main/java/com/ruoyi/common/config/MybatisHandler.java
@@ -14,17 +14,22 @@
public void insertFill(MetaObject metaObject) {
Integer userId = null;
Long tenantId = null;
+ String userName = null;
try {
userId = SecurityUtils.getUserId().intValue();
tenantId = SecurityUtils.getLoginUser().getTenantId();
+ userName = SecurityUtils.getUsername();
} catch (Exception ignored) {
}
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
this.strictInsertFill(metaObject, "createUser", Integer.class, userId);
this.strictInsertFill(metaObject, "updateUser", Integer.class, userId);
- this.strictInsertFill(metaObject, "createUser", Long.class, Optional.ofNullable(userId).orElse(0).longValue());
- this.strictInsertFill(metaObject, "updateUser", Long.class, Optional.ofNullable(userId).orElse(0).longValue());
+ this.strictInsertFill(metaObject, "createUser", Long.class, userId == null ? 0 : userId.longValue());
+ this.strictInsertFill(metaObject, "updateUser", Long.class, userId == null ? 0 : userId.longValue());
+ this.strictInsertFill(metaObject, "createUserName", String.class, userName);
+ this.strictInsertFill(metaObject, "updateUserName", String.class, userName);
+
this.strictInsertFill(metaObject, "tenantId", Long.class, tenantId);
}
--
Gitblit v1.9.3