fix: delete ims user and voip auth

This commit is contained in:
zhangsz
2025-04-11 15:37:49 +08:00
parent 6375bb7d8b
commit cbdec51ba8
3 changed files with 15 additions and 12 deletions

View File

@@ -2,10 +2,10 @@ package model
// @Description VoLTE用户信息 // @Description VoLTE用户信息
type VoIPAuth struct { type VoIPAuth struct {
ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键 ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 主键
NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识 NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识
UserName string `json:"userName" gorm:"column:user_name"` // SIM卡/USIM卡ID UserName string `json:"userName" gorm:"column:user_name"` // SIM卡/USIM卡ID
Password string `json:"password" gorm:"column:password"` // 用户电话号码 Password string `json:"password" gorm:"column:password"` // 用户电话号码
TenantID string `json:"tenantID" gorm:"column:tenant_id"` TenantID string `json:"tenantID" gorm:"column:tenant_id"`
TenantName string `json:"tenantName" gorm:"-"` TenantName string `json:"tenantName" gorm:"-"`

View File

@@ -82,6 +82,10 @@ func (r *IMSUserRepository) SelectPage(query map[string]any) map[string]any {
conditions = append(conditions, "msisdn like concat(concat('%', ?), '%')") conditions = append(conditions, "msisdn like concat(concat('%', ?), '%')")
params = append(params, strings.Trim(v.(string), " ")) 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 != "" { if v, ok := query["imsis"]; ok && v != "" {
placeholder := repo.KeyPlaceholderByQuery(len(v.([]any))) placeholder := repo.KeyPlaceholderByQuery(len(v.([]any)))
conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder)) conditions = append(conditions, fmt.Sprintf("imsi in (%s)", placeholder))
@@ -240,7 +244,7 @@ func (r *IMSUserRepository) Inserts(uArr []model.IMSUser) int64 {
// Delete 删除实体 // Delete 删除实体
func (r *IMSUserRepository) Delete(imsi, neId string) int64 { 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 { if err := tx.Error; err != nil {
logger.Errorf("Delete err => %v", err) logger.Errorf("Delete err => %v", err)
} }

View File

@@ -4,13 +4,13 @@ import (
"fmt" "fmt"
"strings" "strings"
"be.ems/features/ue/model"
dborm "be.ems/lib/core/datasource" dborm "be.ems/lib/core/datasource"
"be.ems/lib/log" "be.ems/lib/log"
"be.ems/src/framework/datasource" "be.ems/src/framework/datasource"
"be.ems/src/framework/logger" "be.ems/src/framework/logger"
"be.ems/src/framework/utils/parse" "be.ems/src/framework/utils/parse"
"be.ems/src/framework/utils/repo" "be.ems/src/framework/utils/repo"
"be.ems/features/ue/model"
) )
// 实例化数据层 VoIPAuthRepository 结构体 // 实例化数据层 VoIPAuthRepository 结构体
@@ -22,11 +22,10 @@ var NewVoIPAuthRepository = &VoIPAuthRepository{
left join sys_tenant t on t.tenant_id = s.tenant_id and t.status = 1`, left join sys_tenant t on t.tenant_id = s.tenant_id and t.status = 1`,
resultMap: map[string]string{ resultMap: map[string]string{
"id": "ID", "id": "ID",
"ne_id": "NeId", "ne_id": "NeId",
"user_name": "UserName", "user_name": "UserName",
"password": "Password", "password": "Password",
"tenant_id": "TenantID", "tenant_id": "TenantID",
"tenant_name": "TenantName", // Tenant name for multi-tenancy "tenant_name": "TenantName", // Tenant name for multi-tenancy
@@ -235,7 +234,7 @@ func (r *VoIPAuthRepository) Inserts(uArr []model.VoIPAuth) int64 {
// Delete 删除实体 // Delete 删除实体
func (r *VoIPAuthRepository) Delete(userName, neId string) int64 { 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 { if err := tx.Error; err != nil {
logger.Errorf("Delete err => %v", err) logger.Errorf("Delete err => %v", err)
} }