fix: udm处理函数返回值统一

This commit is contained in:
TsMask
2025-07-15 15:04:41 +08:00
parent b6d4879cb1
commit 40f178a1cd
13 changed files with 30 additions and 30 deletions

View File

@@ -72,7 +72,7 @@ func (s NBStateController) List(c *gin.Context) {
// 历史记录列表导出 // 历史记录列表导出
// //
// POST /export // GET /export
// //
// @Tags network_data/amf,network_data/mme // @Tags network_data/amf,network_data/mme
// @Accept json // @Accept json
@@ -82,7 +82,7 @@ func (s NBStateController) List(c *gin.Context) {
// @Security TokenAuth // @Security TokenAuth
// @Summary Base Station Status List Export // @Summary Base Station Status List Export
// @Description 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) { func (s NBStateController) Export(c *gin.Context) {
language := reqctx.AcceptLanguage(c) language := reqctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制 // 查询结果,根据查询条件结果,单页最大值限制

View File

@@ -77,8 +77,8 @@ func (s *UDMAuthController) ResetData(c *gin.Context) {
// @Router /neData/udm/auth/list [get] // @Router /neData/udm/auth/list [get]
func (s *UDMAuthController) List(c *gin.Context) { func (s *UDMAuthController) List(c *gin.Context) {
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmAuthService.FindByPage(query) rows, total := s.udmAuthService.FindByPage(query)
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
} }
// UDM鉴权用户信息 // UDM鉴权用户信息
@@ -478,7 +478,7 @@ func (s *UDMAuthController) Export(c *gin.Context) {
} }
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmAuthService.FindByPage(query) rows, total := s.udmAuthService.FindByPage(query)
if total == 0 { if total == 0 {
// 导出数据记录为空 // 导出数据记录为空
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -77,8 +77,8 @@ func (s *UDMSubController) ResetData(c *gin.Context) {
// @Router /neData/udm/sub/list [get] // @Router /neData/udm/sub/list [get]
func (s *UDMSubController) List(c *gin.Context) { func (s *UDMSubController) List(c *gin.Context) {
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmSubService.FindByPage(query) rows, total := s.udmSubService.FindByPage(query)
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
} }
// UDM签约用户信息 // UDM签约用户信息
@@ -484,7 +484,7 @@ func (s *UDMSubController) Export(c *gin.Context) {
} }
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmSubService.FindByPage(query) rows, total := s.udmSubService.FindByPage(query)
if total == 0 { if total == 0 {
// 导出数据记录为空 // 导出数据记录为空
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -76,8 +76,8 @@ func (s *UDMVOIPController) ResetData(c *gin.Context) {
// @Router /neData/udm/voip/list [get] // @Router /neData/udm/voip/list [get]
func (s *UDMVOIPController) List(c *gin.Context) { func (s *UDMVOIPController) List(c *gin.Context) {
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmVOIPService.FindByPage(query) rows, total := s.udmVOIPService.FindByPage(query)
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
} }
// UDMVOIP用户信息 // UDMVOIP用户信息
@@ -416,7 +416,7 @@ func (s *UDMVOIPController) Export(c *gin.Context) {
} }
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmVOIPService.FindByPage(query) rows, total := s.udmVOIPService.FindByPage(query)
if total == 0 { if total == 0 {
// 导出数据记录为空 // 导出数据记录为空
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -76,8 +76,8 @@ func (s *UDMVolteIMSController) ResetData(c *gin.Context) {
// @Router /neData/udm/volte-ims/list [get] // @Router /neData/udm/volte-ims/list [get]
func (s *UDMVolteIMSController) List(c *gin.Context) { func (s *UDMVolteIMSController) List(c *gin.Context) {
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmVolteIMSService.FindByPage(query) rows, total := s.udmVolteIMSService.FindByPage(query)
c.JSON(200, resp.OkData(map[string]any{"total": total, "rows": rows})) c.JSON(200, resp.OkData(map[string]any{"rows": rows, "total": total}))
} }
// UDMVolteIMS用户信息 // UDMVolteIMS用户信息
@@ -462,7 +462,7 @@ func (s *UDMVolteIMSController) Export(c *gin.Context) {
} }
query := reqctx.QueryMap(c) query := reqctx.QueryMap(c)
total, rows := s.udmVolteIMSService.FindByPage(query) rows, total := s.udmVolteIMSService.FindByPage(query)
if total == 0 { if total == 0 {
// 导出数据记录为空 // 导出数据记录为空
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty"))) c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))

View File

@@ -27,7 +27,7 @@ func (r *UDMAuthUser) ClearAndInsert(neId string, uArr []model.UDMAuthUser) int6
} }
// SelectPage 根据条件分页查询 // 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{}) tx := db.DB("").Model(&model.UDMAuthUser{})
// 查询条件拼接 // 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" { if v, ok := query["imsi"]; ok && v != "" {
@@ -48,7 +48,7 @@ func (r *UDMAuthUser) SelectPage(query map[string]string) (int64, []model.UDMAut
// 查询数量 长度为0直接返回 // 查询数量 长度为0直接返回
if err := tx.Count(&total).Error; err != nil || total <= 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) logger.Errorf("query err => %v", err)
} }
return total, rows return rows, total
} }
// SelectList 根据实体查询 // SelectList 根据实体查询

View File

@@ -27,7 +27,7 @@ func (r *UDMSubUser) ClearAndInsert(neId string, u []model.UDMSubUser) int64 {
} }
// SelectPage 根据条件分页查询字典类型 // 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{}) tx := db.DB("").Model(&model.UDMSubUser{})
// 查询条件拼接 // 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" { if v, ok := query["imsi"]; ok && v != "" {
@@ -51,7 +51,7 @@ func (r *UDMSubUser) SelectPage(query map[string]string) (int64, []model.UDMSubU
// 查询数量 长度为0直接返回 // 查询数量 长度为0直接返回
if err := tx.Count(&total).Error; err != nil || total <= 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) logger.Errorf("query err => %v", err)
} }
return total, rows return rows, total
} }
// SelectList 根据实体查询 // SelectList 根据实体查询

View File

@@ -27,7 +27,7 @@ func (r UDMVOIPUser) ClearAndInsert(neId string, uArr []model.UDMVOIPUser) int64
} }
// SelectPage 根据条件分页查询 // 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{}) tx := db.DB("").Model(&model.UDMVOIPUser{})
// 查询条件拼接 // 查询条件拼接
if v, ok := query["username"]; ok && v != "" { if v, ok := query["username"]; ok && v != "" {
@@ -48,7 +48,7 @@ func (r UDMVOIPUser) SelectPage(query map[string]string) (int64, []model.UDMVOIP
// 查询数量 长度为0直接返回 // 查询数量 长度为0直接返回
if err := tx.Count(&total).Error; err != nil || total <= 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) logger.Errorf("query err => %v", err)
} }
return total, rows return rows, total
} }
// SelectList 根据实体查询 // SelectList 根据实体查询

View File

@@ -27,7 +27,7 @@ func (r UDMVolteIMSUser) ClearAndInsert(neId string, uArr []model.UDMVolteIMSUse
} }
// SelectPage 根据条件分页查询 // 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{}) tx := db.DB("").Model(&model.UDMVolteIMSUser{})
// 查询条件拼接 // 查询条件拼接
if v, ok := query["imsi"]; ok && v != "" { if v, ok := query["imsi"]; ok && v != "" {
@@ -57,7 +57,7 @@ func (r UDMVolteIMSUser) SelectPage(query map[string]string) (int64, []model.UDM
// 查询数量 长度为0直接返回 // 查询数量 长度为0直接返回
if err := tx.Count(&total).Error; err != nil || total <= 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) logger.Errorf("query err => %v", err)
} }
return total, rows return rows, total
} }
// SelectList 根据实体查询 // SelectList 根据实体查询

View File

@@ -99,7 +99,7 @@ func (r *UDMAuthUser) ParseInfo(imsi, neId string, data map[string]string) model
} }
// FindByPage 分页查询数据库 // 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) return r.udmAuthRepository.SelectPage(query)
} }

View File

@@ -180,7 +180,7 @@ func (r *UDMSubUser) ParseInfo(imsi, neId string, data map[string]string) model.
} }
// FindByPage 分页查询数据库 // 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) return r.udmSubRepository.SelectPage(query)
} }

View File

@@ -89,7 +89,7 @@ func (r UDMVOIPUser) ParseInfo(neId string, data map[string]string) model.UDMVOI
} }
// FindByPage 分页查询数据库 // 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) return r.udmVOIPRepository.SelectPage(query)
} }

View File

@@ -110,7 +110,7 @@ func (r UDMVolteIMSUser) ParseInfo(neId string, data map[string]string) model.UD
} }
// FindByPage 分页查询数据库 // 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) return r.udmVolteIMSRepository.SelectPage(query)
} }