fix: merge issue

This commit is contained in:
2024-06-28 14:34:09 +08:00
parent 2aeaffb48f
commit ff9ada0676
2 changed files with 5 additions and 3 deletions

View File

@@ -79,6 +79,8 @@ func (r *UDMSubImpl) ClearAndInsert(neID string, u []model.UDMSub) int64 {
if err != nil {
logger.Errorf("TRUNCATE err => %v", err)
}
// multi-tenancy
r.SetTenantID(&u)
return r.Inserts(u)
}
@@ -250,9 +252,9 @@ func (r *UDMSubImpl) DeletePrefixByIMSI(neId, imsi string) int64 {
func (r *UDMSubImpl) SetTenantID(subArr *[]model.UDMSub) {
for s := 0; s < len(*subArr); s++ {
var tenantID []string
err := datasource.DefaultDB().Table("sys_tenant").
err := dborm.DefaultDB().Table("sys_tenant").
Where("status='1' and tenancy_type='IMSI' and ? like tenancy_key", (*subArr)[s].IMSI).
Select("parent_id").Distinct().Find(&tenantID)
Cols("parent_id").Distinct().Find(&tenantID)
if err != nil {
logger.Errorf("Find tenant_id err => %v", err)
continue