add: multi-tenant
This commit is contained in:
@@ -14,7 +14,8 @@ import (
|
||||
// 实例化数据层 UDMSubImpl 结构体
|
||||
var NewUDMSubImpl = &UDMSubImpl{
|
||||
selectSql: `select
|
||||
id, msisdn, imsi, ambr, nssai, rat, arfb, sar, cn, sm_data, smf_sel, eps_dat, ne_id, eps_flag, eps_odb, hplmn_odb, ard, epstpl, context_id, apn_context, static_ip
|
||||
id, msisdn, imsi, ambr, nssai, rat, arfb, sar, cn, sm_data, smf_sel, eps_dat, ne_id, eps_flag, eps_odb, hplmn_odb, ard, epstpl, context_id, apn_context, static_ip,
|
||||
tenant_ids
|
||||
from u_sub_user`,
|
||||
|
||||
resultMap: map[string]string{
|
||||
@@ -39,6 +40,7 @@ var NewUDMSubImpl = &UDMSubImpl{
|
||||
"context_id": "ContextId",
|
||||
"apn_context": "ApnContext",
|
||||
"static_ip": "StaticIp",
|
||||
"tenant_ids": "TenantIDs", // Tenant ID for multi-tenancy
|
||||
},
|
||||
}
|
||||
|
||||
@@ -93,6 +95,11 @@ func (r *UDMSubImpl) SelectPage(query map[string]any) map[string]any {
|
||||
conditions = append(conditions, "ne_id = ?")
|
||||
params = append(params, v)
|
||||
}
|
||||
// for multi-tenancy solution
|
||||
if v, ok := query["tenantIDs"]; ok && v != "" {
|
||||
conditions = append(conditions, "tenant_ids like concat(concat('%', ?), '%')")
|
||||
params = append(params, v)
|
||||
}
|
||||
|
||||
// 构建查询条件语句
|
||||
whereSql := ""
|
||||
|
||||
Reference in New Issue
Block a user