fix: 修复租户ID和创建者覆盖逻辑
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user