feat: 更新数据库索引和分页逻辑,优化查询性能
This commit is contained in:
@@ -111,7 +111,6 @@ func (s BackupExportCDRProcessor) exportIMS(hour int, rmUID, fileType string) st
|
||||
StartTime: start.UnixMilli(),
|
||||
EndTime: end.UnixMilli(),
|
||||
PageNum: 1,
|
||||
PageSize: 30000,
|
||||
}
|
||||
rows, total := s.imsCDREventService.SelectPage(query)
|
||||
if total == 0 {
|
||||
@@ -404,7 +403,6 @@ func (s BackupExportCDRProcessor) exportSMSC(hour int, rmUID, fileType string) s
|
||||
StartTime: start.UnixMilli(),
|
||||
EndTime: end.UnixMilli(),
|
||||
PageNum: 1,
|
||||
PageSize: 30000,
|
||||
}
|
||||
rows, total := s.smscCDREventService.SelectPage(query)
|
||||
if total == 0 {
|
||||
@@ -624,7 +622,6 @@ func (s BackupExportCDRProcessor) exportSMF(hour int, rmUID, fileType string) st
|
||||
StartTime: start.UnixMilli(),
|
||||
EndTime: end.UnixMilli(),
|
||||
PageNum: 1,
|
||||
PageSize: 30000,
|
||||
}
|
||||
rows, total := s.smfCDREventService.SelectPage(query)
|
||||
if total == 0 {
|
||||
@@ -1036,7 +1033,6 @@ func (s BackupExportCDRProcessor) exportSGWC(hour int, rmUID, fileType string) s
|
||||
StartTime: start.UnixMilli(),
|
||||
EndTime: end.UnixMilli(),
|
||||
PageNum: 1,
|
||||
PageSize: 30000,
|
||||
}
|
||||
rows, total := s.sgwcCDREventService.SelectPage(query)
|
||||
if total == 0 {
|
||||
|
||||
@@ -254,6 +254,9 @@ func (r CDREventIMS) SelectByPage(querys model.CDREventIMSQuery) ([]model.CDREve
|
||||
tx = tx.Order(sortField)
|
||||
}
|
||||
|
||||
if querys.PageSize == 0 {
|
||||
querys.PageSize = total
|
||||
}
|
||||
// 查询数据分页
|
||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
|
||||
@@ -63,6 +63,9 @@ func (r CDREventSGWC) SelectByPage(querys model.CDREventSGWCQuery) ([]model.CDRE
|
||||
tx = tx.Order(sortField)
|
||||
}
|
||||
|
||||
if querys.PageSize == 0 {
|
||||
querys.PageSize = total
|
||||
}
|
||||
// 查询数据分页
|
||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
|
||||
@@ -235,6 +235,9 @@ func (r CDREventSMF) SelectByPage(querys model.CDREventSMFQuery) ([]model.CDREve
|
||||
tx = tx.Order(sortField)
|
||||
}
|
||||
|
||||
if querys.PageSize == 0 {
|
||||
querys.PageSize = total
|
||||
}
|
||||
// 查询数据分页
|
||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
|
||||
@@ -255,6 +255,9 @@ func (r CDREventSMSC) SelectByPage(querys model.CDREventSMSCQuery) ([]model.CDRE
|
||||
tx = tx.Order(sortField)
|
||||
}
|
||||
|
||||
if querys.PageSize == 0 {
|
||||
querys.PageSize = total
|
||||
}
|
||||
// 查询数据分页
|
||||
pageNum, pageSize := datasource.PageNumSize(querys.PageNum, querys.PageSize)
|
||||
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
|
||||
|
||||
Reference in New Issue
Block a user