merge: main to multi-tenancy
This commit is contained in:
@@ -154,10 +154,11 @@ func (s *SysTenantController) Add(c *gin.Context) {
|
||||
body.CreateBy = ctx.LoginUserToUserName(c)
|
||||
insertId := s.sysTenantService.InsertTenant(body)
|
||||
if insertId != "" {
|
||||
// 如果是增加SIM Card类型的,需更新udm_sub_user
|
||||
// 如果是增加SIM Card类型的,需更新u_sub_user
|
||||
if body.TenancyType == "IMSI" && body.Status == "1" {
|
||||
affected := s.sysTenantService.UpdateUDMSubTenantID(body.ParentID, body.TenancyKey)
|
||||
log.Tracef("body.ParentID=%s, body.TenancyKey=%s, update affected=%v", body.ParentID, body.TenancyKey, affected)
|
||||
log.Tracef("body.ParentID=%s, body.TenancyKey=%s, update affected=%v",
|
||||
body.ParentID, body.TenancyKey, affected)
|
||||
}
|
||||
c.JSON(200, result.Ok(nil))
|
||||
return
|
||||
@@ -244,7 +245,7 @@ func (s *SysTenantController) Edit(c *gin.Context) {
|
||||
body.UpdateBy = ctx.LoginUserToUserName(c)
|
||||
rows := s.sysTenantService.UpdateTenant(body)
|
||||
if rows > 0 {
|
||||
// 如果是更新的是SIM Card类型的,需更新udm_sub_user
|
||||
// 如果是更新的是SIM Card类型的,需更新u_sub_user
|
||||
// 先清空签约用户原有的租户信息
|
||||
if tenantOldInfo.TenancyType == "IMSI" && tenantOldInfo.Status == "1" {
|
||||
affected := s.sysTenantService.UpdateUDMSubTenantID("", tenantOldInfo.TenancyKey)
|
||||
@@ -304,10 +305,11 @@ func (s *SysTenantController) Remove(c *gin.Context) {
|
||||
tenantOldInfo := s.sysTenantService.SelectTenantById(tenantId)
|
||||
rows := s.sysTenantService.DeleteTenantById(tenantId)
|
||||
if rows > 0 {
|
||||
// 如果是删除的是SIM Card类型的,需删除相关的udm_sub_user的租户信息
|
||||
// 如果是删除的是SIM Card类型的,需删除相关的u_sub_user的租户信息
|
||||
if tenantOldInfo.TenancyType == "IMSI" && tenantOldInfo.Status == "1" {
|
||||
affected := s.sysTenantService.UpdateUDMSubTenantID("", tenantOldInfo.TenancyKey)
|
||||
log.Tracef("tenantOldInfo.ParentID=%s, tenantOldInfo.TenancyKey=%s, update affected=%v", tenantOldInfo.ParentID, tenantOldInfo.TenancyKey, affected)
|
||||
log.Tracef("tenantOldInfo.ParentID=%s, tenantOldInfo.TenancyKey=%s, update affected=%v",
|
||||
tenantOldInfo.ParentID, tenantOldInfo.TenancyKey, affected)
|
||||
}
|
||||
// 删除成功:%d
|
||||
msg := i18n.TTemplate(language, "app.common.deleteSuccess", map[string]any{"num": rows})
|
||||
|
||||
Reference in New Issue
Block a user