From cbdec51ba8eadf90a61bb1092ab3c9a057698e1c Mon Sep 17 00:00:00 2001 From: zhangsz Date: Fri, 11 Apr 2025 15:37:49 +0800 Subject: [PATCH] fix: delete ims user and voip auth --- features/ue/model/voip_auth.go | 8 ++++---- features/ue/repository/ims_user.go | 6 +++++- features/ue/repository/voip_auth.go | 13 ++++++------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/features/ue/model/voip_auth.go b/features/ue/model/voip_auth.go index 0e07514e..0467c9a2 100644 --- a/features/ue/model/voip_auth.go +++ b/features/ue/model/voip_auth.go @@ -2,10 +2,10 @@ package model // @Description VoLTE用户信息 type VoIPAuth struct { - ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 - NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 - UserName string `json:"userName" gorm:"column:user_name"` // SIM卡/USIM卡ID - Password string `json:"password" gorm:"column:password"` // 用户电话号码 + ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 + NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 + UserName string `json:"userName" gorm:"column:user_name"` // SIM卡/USIM卡ID + Password string `json:"password" gorm:"column:password"` // 用户电话号码 TenantID string `json:"tenantID" gorm:"column:tenant_id"` TenantName string `json:"tenantName" gorm:"-"` diff --git a/features/ue/repository/ims_user.go b/features/ue/repository/ims_user.go index 08667e91..6ced5903 100644 --- a/features/ue/repository/ims_user.go +++ b/features/ue/repository/ims_user.go @@ -82,6 +82,10 @@ func (r *IMSUserRepository) SelectPage(query map[string]any) map[string]any { conditions = append(conditions, "msisdn like concat(concat('%', ?), '%')") params = append(params, strings.Trim(v.(string), " ")) } + if v, ok := query["tag"]; ok && v != "" { + conditions = append(conditions, "tag=?") + params = append(params, strings.Trim(v.(string), " ")) + } if v, ok := query["imsis"]; ok && v != "" { placeholder := repo.KeyPlaceholderByQuery(len(v.([]any))) conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder)) @@ -240,7 +244,7 @@ func (r *IMSUserRepository) Inserts(uArr []model.IMSUser) int64 { // Delete 删除实体 func (r *IMSUserRepository) Delete(imsi, neId string) int64 { - tx := datasource.DefaultDB().Where("imsi = ? and ne_id = ?", imsi, neId).Delete(&IMSUserRepository{}) + tx := datasource.DefaultDB().Where("imsi = ? and ne_id = ?", imsi, neId).Delete(&model.IMSUser{}) if err := tx.Error; err != nil { logger.Errorf("Delete err => %v", err) } diff --git a/features/ue/repository/voip_auth.go b/features/ue/repository/voip_auth.go index bbe263ab..2c49484b 100644 --- a/features/ue/repository/voip_auth.go +++ b/features/ue/repository/voip_auth.go @@ -4,13 +4,13 @@ import ( "fmt" "strings" + "be.ems/features/ue/model" dborm "be.ems/lib/core/datasource" "be.ems/lib/log" "be.ems/src/framework/datasource" "be.ems/src/framework/logger" "be.ems/src/framework/utils/parse" "be.ems/src/framework/utils/repo" - "be.ems/features/ue/model" ) // 实例化数据层 VoIPAuthRepository 结构体 @@ -22,11 +22,10 @@ var NewVoIPAuthRepository = &VoIPAuthRepository{ left join sys_tenant t on t.tenant_id = s.tenant_id and t.status = 1`, resultMap: map[string]string{ - "id": "ID", - "ne_id": "NeId", - "user_name": "UserName", - "password": "Password", - + "id": "ID", + "ne_id": "NeId", + "user_name": "UserName", + "password": "Password", "tenant_id": "TenantID", "tenant_name": "TenantName", // Tenant name for multi-tenancy @@ -235,7 +234,7 @@ func (r *VoIPAuthRepository) Inserts(uArr []model.VoIPAuth) int64 { // Delete 删除实体 func (r *VoIPAuthRepository) Delete(userName, neId string) int64 { - tx := datasource.DefaultDB().Where("user_name = ? and ne_id = ?", userName, neId).Delete(&VoIPAuthRepository{}) + tx := datasource.DefaultDB().Where("user_name = ? and ne_id = ?", userName, neId).Delete(&model.VoIPAuth{}) if err := tx.Error; err != nil { logger.Errorf("Delete err => %v", err) }