From 38f5d74f4ab92299e07026bdf264f903207b6cef Mon Sep 17 00:00:00 2001 From: qhd <1766646056@qq.com> Date: Wed, 22 Apr 2026 09:43:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A7=9F=E6=88=B7ID?= =?UTF-8?q?=E5=92=8C=E5=88=9B=E5=BB=BA=E8=80=85=E8=A6=86=E7=9B=96=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/gfdb/gfdb.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/db/gfdb/gfdb.go b/db/gfdb/gfdb.go index d44a9f2..0e2da34 100644 --- a/db/gfdb/gfdb.go +++ b/db/gfdb/gfdb.go @@ -179,17 +179,21 @@ func insertHook(ctx context.Context, in *gdb.HookInsertInput) (result sql.Result in.Data[i]["id"] = node.Generate().Int64() } if _, ok := in.Data[i]["tenant_id"]; ok { - if !g.IsEmpty(userInfo.TenantId) { - in.Data[i]["tenant_id"] = userInfo.TenantId - } else { - return nil, fmt.Errorf("tenantId cannot be empty") + if g.IsEmpty(in.Data[i]["tenant_id"]) { + if !g.IsEmpty(userInfo.TenantId) { + in.Data[i]["tenant_id"] = userInfo.TenantId + } else { + return nil, fmt.Errorf("tenantId cannot be empty") + } } } if _, ok := in.Data[i]["creator"]; ok { - if !g.IsEmpty(userInfo.UserName) { - in.Data[i]["creator"] = userInfo.UserName - } else { - return nil, fmt.Errorf("user info cannot be empty") + if g.IsEmpty(in.Data[i]["tenant_id"]) { + if !g.IsEmpty(userInfo.UserName) { + in.Data[i]["creator"] = userInfo.UserName + } else { + return nil, fmt.Errorf("user info cannot be empty") + } } } if _, ok := in.Data[i]["updater"]; ok {