Browse Source

提交代码

tags/v1.22.3.2^2
yanchao 3 years ago
parent
commit
7c0b40ffd7
1 changed files with 13 additions and 2 deletions
  1. +13
    -2
      models/dataset.go

+ 13
- 2
models/dataset.go View File

@@ -1,11 +1,11 @@
package models

import (
logger "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/timeutil"
"errors"
"fmt"
"sort"

"code.gitea.io/gitea/modules/timeutil"
"xorm.io/builder"
)

@@ -198,6 +198,13 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da
Join("INNER", "attachment", "attachment.dataset_id=dataset.id").
Where(cond).Count(new(Dataset))

a, b := sess.LastSQL()
logger.Warn("sql:" + a)

for _, v := range b {
logger.Warn("arg:" + v.(string))
}

if err != nil {
return nil, 0, fmt.Errorf("Count: %v", err)
}
@@ -205,6 +212,10 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da
sess.Select(selectColumnsSql).Join("INNER", "repository", "repository.id = dataset.repo_id").
Join("INNER", "attachment", "attachment.dataset_id=dataset.id").
Where(cond).OrderBy(opts.SearchOrderBy.String())
a, b = sess.LastSQL()
logger.Warn("sql:" + a)

print(a, b)
if opts.PageSize > 0 {
sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize)
}


Loading…
Cancel
Save