Merge pull request #14014 from wy65701436/fixes-13985

fix robot list issue
This commit is contained in:
stonezdj(Daojun Zhang) 2021-01-15 14:44:35 +08:00 committed by GitHub
commit f31f861e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -119,6 +119,9 @@ func (d *dao) List(ctx context.Context, query *q.Query) ([]*model.Robot, error)
if err != nil {
return nil, err
}
if query.Sorting != "" {
qs = qs.OrderBy(query.Sorting)
}
if _, err = qs.All(&robots); err != nil {
return nil, err
}

View File

@ -81,5 +81,9 @@ func (m *manager) Update(ctx context.Context, r *model.Robot, props ...string) e
// List ...
func (m *manager) List(ctx context.Context, query *q.Query) ([]*model.Robot, error) {
query = q.MustClone(query)
if query.Sorting == "" {
query.Sorting = "name"
}
return m.dao.List(ctx, query)
}