feat: 更新导出cdr分页逻辑,1页最大条数为条件的总条数
This commit is contained in:
@@ -111,6 +111,7 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st
|
|||||||
StartTime: start.UnixMilli(),
|
StartTime: start.UnixMilli(),
|
||||||
EndTime: end.UnixMilli(),
|
EndTime: end.UnixMilli(),
|
||||||
PageNum: 1,
|
PageNum: 1,
|
||||||
|
PageSize: 1000_0000,
|
||||||
}
|
}
|
||||||
rows, total := s.imsCDREventService.SelectPage(query)
|
rows, total := s.imsCDREventService.SelectPage(query)
|
||||||
if total == 0 {
|
if total == 0 {
|
||||||
@@ -403,6 +404,7 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s
|
|||||||
StartTime: start.UnixMilli(),
|
StartTime: start.UnixMilli(),
|
||||||
EndTime: end.UnixMilli(),
|
EndTime: end.UnixMilli(),
|
||||||
PageNum: 1,
|
PageNum: 1,
|
||||||
|
PageSize: 1000_0000,
|
||||||
}
|
}
|
||||||
rows, total := s.smscCDREventService.SelectPage(query)
|
rows, total := s.smscCDREventService.SelectPage(query)
|
||||||
if total == 0 {
|
if total == 0 {
|
||||||
@@ -622,6 +624,7 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st
|
|||||||
StartTime: start.UnixMilli(),
|
StartTime: start.UnixMilli(),
|
||||||
EndTime: end.UnixMilli(),
|
EndTime: end.UnixMilli(),
|
||||||
PageNum: 1,
|
PageNum: 1,
|
||||||
|
PageSize: 1000_0000,
|
||||||
}
|
}
|
||||||
rows, total := s.smfCDREventService.SelectPage(query)
|
rows, total := s.smfCDREventService.SelectPage(query)
|
||||||
if total == 0 {
|
if total == 0 {
|
||||||
@@ -1033,6 +1036,7 @@ func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) s
|
|||||||
StartTime: start.UnixMilli(),
|
StartTime: start.UnixMilli(),
|
||||||
EndTime: end.UnixMilli(),
|
EndTime: end.UnixMilli(),
|
||||||
PageNum: 1,
|
PageNum: 1,
|
||||||
|
PageSize: 1000_0000,
|
||||||
}
|
}
|
||||||
rows, total := s.sgwcCDREventService.SelectPage(query)
|
rows, total := s.sgwcCDREventService.SelectPage(query)
|
||||||
if total == 0 {
|
if total == 0 {
|
||||||
|
|||||||
@@ -254,11 +254,11 @@ func (r CDREventIMS) SelectByPage(querys model.CDREventIMSQuery) ([]model.CDREve
|
|||||||
tx = tx.Order(sortField)
|
tx = tx.Order(sortField)
|
||||||
}
|
}
|
||||||
|
|
||||||
if querys.PageSize == 0 {
|
|
||||||
querys.PageSize = total
|
|
||||||
}
|
|
||||||
// 查询数据分页
|
// 查询数据分页
|
||||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||||
|
if pageNum == 0 && pageSize > int(total) {
|
||||||
|
pageSize = int(total)
|
||||||
|
}
|
||||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||||
err := tx.Find(&rows).Error
|
err := tx.Find(&rows).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ func (r CDREventSGWC) SelectByPage(querys model.CDREventSGWCQuery) ([]model.CDRE
|
|||||||
tx = tx.Order(sortField)
|
tx = tx.Order(sortField)
|
||||||
}
|
}
|
||||||
|
|
||||||
if querys.PageSize == 0 {
|
|
||||||
querys.PageSize = total
|
|
||||||
}
|
|
||||||
// 查询数据分页
|
// 查询数据分页
|
||||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||||
|
if pageNum == 0 && pageSize > int(total) {
|
||||||
|
pageSize = int(total)
|
||||||
|
}
|
||||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||||
err := tx.Find(&rows).Error
|
err := tx.Find(&rows).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -235,11 +235,11 @@ func (r CDREventSMF) SelectByPage(querys model.CDREventSMFQuery) ([]model.CDREve
|
|||||||
tx = tx.Order(sortField)
|
tx = tx.Order(sortField)
|
||||||
}
|
}
|
||||||
|
|
||||||
if querys.PageSize == 0 {
|
|
||||||
querys.PageSize = total
|
|
||||||
}
|
|
||||||
// 查询数据分页
|
// 查询数据分页
|
||||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||||
|
if pageNum == 0 && pageSize > int(total) {
|
||||||
|
pageSize = int(total)
|
||||||
|
}
|
||||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||||
err := tx.Find(&rows).Error
|
err := tx.Find(&rows).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -255,11 +255,11 @@ func (r CDREventSMSC) SelectByPage(querys model.CDREventSMSCQuery) ([]model.CDRE
|
|||||||
tx = tx.Order(sortField)
|
tx = tx.Order(sortField)
|
||||||
}
|
}
|
||||||
|
|
||||||
if querys.PageSize == 0 {
|
|
||||||
querys.PageSize = total
|
|
||||||
}
|
|
||||||
// 查询数据分页
|
// 查询数据分页
|
||||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||||
|
if pageNum == 0 && pageSize > int(total) {
|
||||||
|
pageSize = int(total)
|
||||||
|
}
|
||||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||||
err := tx.Find(&rows).Error
|
err := tx.Find(&rows).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user