Skip to content

Commit

Permalink
fix: an sql error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmx233 committed Mar 14, 2024
1 parent 0f613b0 commit 2fade2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/db/dao/UserGroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (a *UserGroups) GetUserGroupsForPubByUIDWithPreOrder(tx *gorm.DB, uid ...ui
groupModel := &BaseGroup{}
tx = tx.Model(groupModel)
tx = groupModel.sqlJoinUserGroups(tx)
return t, tx.Where("user_groups.uid IN ?", uid).
return t, tx.Select("base_groups.id", "base_groups.name", "user_groups.uid").Where("user_groups.uid IN ?", uid).
Clauses(clause.OrderBy{Expression: clause.Expr{SQL: "FIELD(user_groups.uid,?),user_groups.id DESC", Vars: []interface{}{uid}, WithoutParentheses: true}}).
Find(&t).Error
}
Expand Down

0 comments on commit 2fade2a

Please sign in to comment.