|
|
|
@@ -7,7 +7,6 @@ import ( |
|
|
|
"time" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"code.gitea.io/gitea/modules/timeutil" |
|
|
|
"xorm.io/builder" |
|
|
|
) |
|
|
|
@@ -183,7 +182,7 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus |
|
|
|
} |
|
|
|
statictisSess.OrderBy("count_date desc") |
|
|
|
|
|
|
|
userBusinessAnalysisList := make([]*UserBusinessAnalysis, 0, setting.UI.IssuePagingNum) |
|
|
|
userBusinessAnalysisList := make([]*UserBusinessAnalysis, 0) |
|
|
|
if err := statictisSess.Table("user_business_analysis").Where(cond). |
|
|
|
Find(&userBusinessAnalysisList); err != nil { |
|
|
|
return nil, 0 |
|
|
|
@@ -191,27 +190,29 @@ func QueryUserStaticDataPage(opts *UserBusinessAnalysisQueryOptions) ([]*UserBus |
|
|
|
|
|
|
|
resultMap := make(map[int64]*UserBusinessAnalysis) |
|
|
|
|
|
|
|
var newAndCond = builder.NewCond() |
|
|
|
var newOrCond = builder.NewCond() |
|
|
|
for _, userRecord := range userBusinessAnalysisList { |
|
|
|
newOrCond.Or( |
|
|
|
builder.Eq{"id": userRecord.ID}, |
|
|
|
if opts.Page >= 0 && opts.PageSize > 0 { |
|
|
|
var newAndCond = builder.NewCond() |
|
|
|
var newOrCond = builder.NewCond() |
|
|
|
for _, userRecord := range userBusinessAnalysisList { |
|
|
|
newOrCond.Or( |
|
|
|
builder.Eq{"id": userRecord.ID}, |
|
|
|
) |
|
|
|
} |
|
|
|
newAndCond = newAndCond.And( |
|
|
|
newOrCond, |
|
|
|
) |
|
|
|
newAndCond = newAndCond.And( |
|
|
|
builder.Gte{"count_date": fmt.Sprint(opts.StartTime)}, |
|
|
|
) |
|
|
|
newAndCond = newAndCond.And( |
|
|
|
builder.Lte{"count_date": fmt.Sprint(opts.EndTime)}, |
|
|
|
) |
|
|
|
} |
|
|
|
newAndCond = newAndCond.And( |
|
|
|
newOrCond, |
|
|
|
) |
|
|
|
newAndCond = newAndCond.And( |
|
|
|
builder.Gte{"count_date": fmt.Sprint(opts.StartTime)}, |
|
|
|
) |
|
|
|
newAndCond = newAndCond.And( |
|
|
|
builder.Lte{"count_date": fmt.Sprint(opts.EndTime)}, |
|
|
|
) |
|
|
|
|
|
|
|
userBusinessAnalysisList = make([]*UserBusinessAnalysis, 0) |
|
|
|
if err := statictisSess.Table("user_business_analysis").Where(newAndCond). |
|
|
|
Find(&userBusinessAnalysisList); err != nil { |
|
|
|
return nil, 0 |
|
|
|
userBusinessAnalysisList = make([]*UserBusinessAnalysis, 0) |
|
|
|
if err := statictisSess.Table("user_business_analysis").Where(newAndCond). |
|
|
|
Find(&userBusinessAnalysisList); err != nil { |
|
|
|
return nil, 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.Info("query result size=" + fmt.Sprint(len(userBusinessAnalysisList))) |
|
|
|
|