From 13f103c318585d6beebd2b8ad6bc5b8a250e03f4 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 23 Nov 2021 09:01:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E5=8F=8A=E7=95=8C=E9=9D=A2=E6=89=80=E6=9C=89=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 9e9bf7f3a..99a05c031 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -199,17 +199,16 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus } statictisSess.Limit(opts.PageSize, start) } - statictisSess.OrderBy("count_date desc") userBusinessAnalysisList := make([]*UserBusinessAnalysis, 0) - if err := statictisSess.Table("user_business_analysis").Where(cond). + if err := statictisSess.Table("user_business_analysis").Where(cond).OrderBy("count_date desc"). Find(&userBusinessAnalysisList); err != nil { return nil, 0 } resultMap := make(map[int64]*UserBusinessAnalysis) - if opts.Page >= 0 && opts.PageSize > 0 && len(userBusinessAnalysisList) > 0 { + if len(userBusinessAnalysisList) > 0 { var newAndCond = builder.NewCond() var newOrCond = builder.NewCond() for _, userRecord := range userBusinessAnalysisList { @@ -228,9 +227,8 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus builder.Lte{"count_date": opts.EndTime}, ) } - userBusinessAnalysisList = make([]*UserBusinessAnalysis, 0) - if err := statictisSess.Table("user_business_analysis").Where(newAndCond). + if err := statictisSess.Table("user_business_analysis").Where(newAndCond).OrderBy("count_date desc"). Find(&userBusinessAnalysisList); err != nil { return nil, 0 }