diff --git a/service/split_account_deduction_log.go b/service/split_account_deduction_log.go index 19d4f32..2f3c9c2 100644 --- a/service/split_account_deduction_log.go +++ b/service/split_account_deduction_log.go @@ -233,9 +233,9 @@ func (s *SplitAccountDeductionLogService) GetSplitAccountDeductionLogSummary(req FROM split_account_deduction_log WHERE created_by = ? GROUP BY business_no - ORDER BY business_no DESC + ORDER BY MIN(created_at) DESC LIMIT ? OFFSET ?` - fmt.Printf("[SQL] summary-data: WHERE created_by = '%s' GROUP BY business_no ORDER BY business_no DESC LIMIT %d OFFSET %d\n", createdBy, req.PageSize, offset) + fmt.Printf("[SQL] summary-data: WHERE created_by = '%s' GROUP BY business_no ORDER BY MIN(created_at) DESC LIMIT %d OFFSET %d\n", createdBy, req.PageSize, offset) if err := databaseConn.Raw(dataSQL, createdBy, req.PageSize, offset).Scan(&results).Error; err != nil { return nil, utils.NewError("查询分账扣钱日志汇总失败") } @@ -245,9 +245,9 @@ func (s *SplitAccountDeductionLogService) GetSplitAccountDeductionLogSummary(req MIN(created_at) AS created_at, MIN(updated_at) AS updated_at FROM split_account_deduction_log GROUP BY business_no - ORDER BY business_no DESC + ORDER BY MIN(created_at) DESC LIMIT ? OFFSET ?` - fmt.Printf("[SQL] summary-data: GROUP BY business_no ORDER BY business_no DESC LIMIT %d OFFSET %d\n", req.PageSize, offset) + fmt.Printf("[SQL] summary-data: GROUP BY business_no ORDER BY MIN(created_at) DESC LIMIT %d OFFSET %d\n", req.PageSize, offset) if err := databaseConn.Raw(dataSQL, req.PageSize, offset).Scan(&results).Error; err != nil { return nil, utils.NewError("查询分账扣钱日志汇总失败") }