add: multi-tenant

This commit is contained in:
2024-06-06 11:27:42 +08:00
parent 6ce288c3ef
commit 82420a8445
14 changed files with 1253 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package repository
import (
"fmt"
"strconv"
"strings"
@@ -40,7 +41,7 @@ var NewUDMSubImpl = &UDMSubImpl{
"context_id": "ContextId",
"apn_context": "ApnContext",
"static_ip": "StaticIp",
"tenant_name": "TenantName", // Tenant ID for multi-tenancy
"tenant_name": "TenantName", // Tenant name for multi-tenancy
},
}
@@ -97,8 +98,9 @@ func (r *UDMSubImpl) SelectPage(query map[string]any) map[string]any {
}
// for multi-tenancy solution
if v, ok := query["tenantName"]; ok && v != "" {
conditions = append(conditions, "tenant_name = '?'")
conditions = append(conditions, "tenant_name = ?")
params = append(params, v)
fmt.Printf("tenantName = %s", v)
}
// 构建查询条件语句