| @@ -199,17 +199,16 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus | |||||
| } | } | ||||
| statictisSess.Limit(opts.PageSize, start) | statictisSess.Limit(opts.PageSize, start) | ||||
| } | } | ||||
| statictisSess.OrderBy("count_date desc") | |||||
| userBusinessAnalysisList := make([]*UserBusinessAnalysis, 0) | 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 { | Find(&userBusinessAnalysisList); err != nil { | ||||
| return nil, 0 | return nil, 0 | ||||
| } | } | ||||
| resultMap := make(map[int64]*UserBusinessAnalysis) | resultMap := make(map[int64]*UserBusinessAnalysis) | ||||
| if opts.Page >= 0 && opts.PageSize > 0 && len(userBusinessAnalysisList) > 0 { | |||||
| if len(userBusinessAnalysisList) > 0 { | |||||
| var newAndCond = builder.NewCond() | var newAndCond = builder.NewCond() | ||||
| var newOrCond = builder.NewCond() | var newOrCond = builder.NewCond() | ||||
| for _, userRecord := range userBusinessAnalysisList { | for _, userRecord := range userBusinessAnalysisList { | ||||
| @@ -228,9 +227,8 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus | |||||
| builder.Lte{"count_date": opts.EndTime}, | builder.Lte{"count_date": opts.EndTime}, | ||||
| ) | ) | ||||
| } | } | ||||
| userBusinessAnalysisList = make([]*UserBusinessAnalysis, 0) | 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 { | Find(&userBusinessAnalysisList); err != nil { | ||||
| return nil, 0 | return nil, 0 | ||||
| } | } | ||||