|
|
@@ -282,7 +282,7 @@ func generateFilterCond(opts *SearchDatasetOptions, cond builder.Cond) builder.C |
|
|
|
cond = cond.And(builder.Eq{"attachment.type": opts.CloudBrainType}) |
|
|
|
} |
|
|
|
if opts.UploadAttachmentByMe { |
|
|
|
cond = cond.And(builder.Eq{"attachment.uploader_id": opts.OwnerID}) |
|
|
|
cond = cond.And(builder.Eq{"attachment.uploader_id": opts.User.ID}) |
|
|
|
} |
|
|
|
|
|
|
|
return cond |
|
|
@@ -311,7 +311,8 @@ 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, _ := sess.LastSQL() |
|
|
|
log.Warn("dataset sql:" + a) |
|
|
|
if opts.PageSize > 0 { |
|
|
|
sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) |
|
|
|
} |
|
|
|