fix: udm处理函数返回值统一
This commit is contained in:
@@ -72,7 +72,7 @@ func (s NBStateController) List(c *gin.Context) {
|
||||
|
||||
// 历史记录列表导出
|
||||
//
|
||||
// POST /export
|
||||
// GET /export
|
||||
//
|
||||
// @Tags network_data/amf,network_data/mme
|
||||
// @Accept json
|
||||
@@ -82,7 +82,7 @@ func (s NBStateController) List(c *gin.Context) {
|
||||
// @Security TokenAuth
|
||||
// @Summary Base Station Status List Export
|
||||
// @Description Base Station Status List Export
|
||||
// @Router /nb-state/export [post]
|
||||
// @Router /nb-state/export [get]
|
||||
func (s NBStateController) Export(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
// 查询结果,根据查询条件结果,单页最大值限制
|
||||
|
||||
@@ -77,8 +77,8 @@ func (s *UDMAuthController) ResetData(c *gin.Context) {
|
||||
// @Router /neData/udm/auth/list [get]
|
||||
func (s *UDMAuthController) List(c *gin.Context) {
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmAuthService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows}))
|
||||
rows, total := s.udmAuthService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
|
||||
}
|
||||
|
||||
// UDM鉴权用户信息
|
||||
@@ -478,7 +478,7 @@ func (s *UDMAuthController) Export(c *gin.Context) {
|
||||
}
|
||||
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmAuthService.FindByPage(query)
|
||||
rows, total := s.udmAuthService.FindByPage(query)
|
||||
if total == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
|
||||
@@ -77,8 +77,8 @@ func (s *UDMSubController) ResetData(c *gin.Context) {
|
||||
// @Router /neData/udm/sub/list [get]
|
||||
func (s *UDMSubController) List(c *gin.Context) {
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmSubService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows}))
|
||||
rows, total := s.udmSubService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
|
||||
}
|
||||
|
||||
// UDM签约用户信息
|
||||
@@ -484,7 +484,7 @@ func (s *UDMSubController) Export(c *gin.Context) {
|
||||
}
|
||||
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmSubService.FindByPage(query)
|
||||
rows, total := s.udmSubService.FindByPage(query)
|
||||
if total == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
|
||||
@@ -76,8 +76,8 @@ func (s *UDMVOIPController) ResetData(c *gin.Context) {
|
||||
// @Router /neData/udm/voip/list [get]
|
||||
func (s *UDMVOIPController) List(c *gin.Context) {
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmVOIPService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows}))
|
||||
rows, total := s.udmVOIPService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
|
||||
}
|
||||
|
||||
// UDMVOIP用户信息
|
||||
@@ -416,7 +416,7 @@ func (s *UDMVOIPController) Export(c *gin.Context) {
|
||||
}
|
||||
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmVOIPService.FindByPage(query)
|
||||
rows, total := s.udmVOIPService.FindByPage(query)
|
||||
if total == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
|
||||
@@ -76,8 +76,8 @@ func (s *UDMVolteIMSController) ResetData(c *gin.Context) {
|
||||
// @Router /neData/udm/volte-ims/list [get]
|
||||
func (s *UDMVolteIMSController) List(c *gin.Context) {
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmVolteIMSService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows}))
|
||||
rows, total := s.udmVolteIMSService.FindByPage(query)
|
||||
c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
|
||||
}
|
||||
|
||||
// UDMVolteIMS用户信息
|
||||
@@ -462,7 +462,7 @@ func (s *UDMVolteIMSController) Export(c *gin.Context) {
|
||||
}
|
||||
|
||||
query := reqctx.QueryMap(c)
|
||||
total, rows := s.udmVolteIMSService.FindByPage(query)
|
||||
rows, total := s.udmVolteIMSService.FindByPage(query)
|
||||
if total == 0 {
|
||||
// 导出数据记录为空
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
|
||||
|
||||
@@ -27,7 +27,7 @@ func (r *UDMAuthUser) ClearAndInsert(neId string, uArr []model.UDMAuthUser) int6
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *UDMAuthUser) SelectPage(query map[string]string) (int64, []model.UDMAuthUser) {
|
||||
func (r *UDMAuthUser) SelectPage(query map[string]string) ([]model.UDMAuthUser, int64) {
|
||||
tx := db.DB("").Model(&model.UDMAuthUser{})
|
||||
// 查询条件拼接
|
||||
if v, ok := query["imsi"]; ok && v != "" {
|
||||
@@ -48,7 +48,7 @@ func (r *UDMAuthUser) SelectPage(query map[string]string) (int64, []model.UDMAut
|
||||
|
||||
// 查询数量 长度为0直接返回
|
||||
if err := tx.Count(&total).Error; err != nil || total <= 0 {
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// 分页
|
||||
@@ -73,7 +73,7 @@ func (r *UDMAuthUser) SelectPage(query map[string]string) (int64, []model.UDMAut
|
||||
logger.Errorf("query err => %v", err)
|
||||
}
|
||||
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// SelectList 根据实体查询
|
||||
|
||||
@@ -27,7 +27,7 @@ func (r *UDMSubUser) ClearAndInsert(neId string, u []model.UDMSubUser) int64 {
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询字典类型
|
||||
func (r *UDMSubUser) SelectPage(query map[string]string) (int64, []model.UDMSubUser) {
|
||||
func (r *UDMSubUser) SelectPage(query map[string]string) ([]model.UDMSubUser, int64) {
|
||||
tx := db.DB("").Model(&model.UDMSubUser{})
|
||||
// 查询条件拼接
|
||||
if v, ok := query["imsi"]; ok && v != "" {
|
||||
@@ -51,7 +51,7 @@ func (r *UDMSubUser) SelectPage(query map[string]string) (int64, []model.UDMSubU
|
||||
|
||||
// 查询数量 长度为0直接返回
|
||||
if err := tx.Count(&total).Error; err != nil || total <= 0 {
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// 分页
|
||||
@@ -76,7 +76,7 @@ func (r *UDMSubUser) SelectPage(query map[string]string) (int64, []model.UDMSubU
|
||||
logger.Errorf("query err => %v", err)
|
||||
}
|
||||
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// SelectList 根据实体查询
|
||||
|
||||
@@ -27,7 +27,7 @@ func (r UDMVOIPUser) ClearAndInsert(neId string, uArr []model.UDMVOIPUser) int64
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r UDMVOIPUser) SelectPage(query map[string]string) (int64, []model.UDMVOIPUser) {
|
||||
func (r UDMVOIPUser) SelectPage(query map[string]string) ([]model.UDMVOIPUser, int64) {
|
||||
tx := db.DB("").Model(&model.UDMVOIPUser{})
|
||||
// 查询条件拼接
|
||||
if v, ok := query["username"]; ok && v != "" {
|
||||
@@ -48,7 +48,7 @@ func (r UDMVOIPUser) SelectPage(query map[string]string) (int64, []model.UDMVOIP
|
||||
|
||||
// 查询数量 长度为0直接返回
|
||||
if err := tx.Count(&total).Error; err != nil || total <= 0 {
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// 分页
|
||||
@@ -75,7 +75,7 @@ func (r UDMVOIPUser) SelectPage(query map[string]string) (int64, []model.UDMVOIP
|
||||
logger.Errorf("query err => %v", err)
|
||||
}
|
||||
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// SelectList 根据实体查询
|
||||
|
||||
@@ -27,7 +27,7 @@ func (r UDMVolteIMSUser) ClearAndInsert(neId string, uArr []model.UDMVolteIMSUse
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r UDMVolteIMSUser) SelectPage(query map[string]string) (int64, []model.UDMVolteIMSUser) {
|
||||
func (r UDMVolteIMSUser) SelectPage(query map[string]string) ([]model.UDMVolteIMSUser, int64) {
|
||||
tx := db.DB("").Model(&model.UDMVolteIMSUser{})
|
||||
// 查询条件拼接
|
||||
if v, ok := query["imsi"]; ok && v != "" {
|
||||
@@ -57,7 +57,7 @@ func (r UDMVolteIMSUser) SelectPage(query map[string]string) (int64, []model.UDM
|
||||
|
||||
// 查询数量 长度为0直接返回
|
||||
if err := tx.Count(&total).Error; err != nil || total <= 0 {
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// 分页
|
||||
@@ -84,7 +84,7 @@ func (r UDMVolteIMSUser) SelectPage(query map[string]string) (int64, []model.UDM
|
||||
logger.Errorf("query err => %v", err)
|
||||
}
|
||||
|
||||
return total, rows
|
||||
return rows, total
|
||||
}
|
||||
|
||||
// SelectList 根据实体查询
|
||||
|
||||
@@ -99,7 +99,7 @@ func (r *UDMAuthUser) ParseInfo(imsi, neId string, data map[string]string) model
|
||||
}
|
||||
|
||||
// FindByPage 分页查询数据库
|
||||
func (r *UDMAuthUser) FindByPage(query map[string]string) (int64, []model.UDMAuthUser) {
|
||||
func (r *UDMAuthUser) FindByPage(query map[string]string) ([]model.UDMAuthUser, int64) {
|
||||
return r.udmAuthRepository.SelectPage(query)
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ func (r *UDMSubUser) ParseInfo(imsi, neId string, data map[string]string) model.
|
||||
}
|
||||
|
||||
// FindByPage 分页查询数据库
|
||||
func (r *UDMSubUser) FindByPage(query map[string]string) (int64, []model.UDMSubUser) {
|
||||
func (r *UDMSubUser) FindByPage(query map[string]string) ([]model.UDMSubUser, int64) {
|
||||
return r.udmSubRepository.SelectPage(query)
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ func (r UDMVOIPUser) ParseInfo(neId string, data map[string]string) model.UDMVOI
|
||||
}
|
||||
|
||||
// FindByPage 分页查询数据库
|
||||
func (r UDMVOIPUser) FindByPage(query map[string]string) (int64, []model.UDMVOIPUser) {
|
||||
func (r UDMVOIPUser) FindByPage(query map[string]string) ([]model.UDMVOIPUser, int64) {
|
||||
return r.udmVOIPRepository.SelectPage(query)
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ func (r UDMVolteIMSUser) ParseInfo(neId string, data map[string]string) model.UD
|
||||
}
|
||||
|
||||
// FindByPage 分页查询数据库
|
||||
func (r UDMVolteIMSUser) FindByPage(query map[string]string) (int64, []model.UDMVolteIMSUser) {
|
||||
func (r UDMVolteIMSUser) FindByPage(query map[string]string) ([]model.UDMVolteIMSUser, int64) {
|
||||
return r.udmVolteIMSRepository.SelectPage(query)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user