Skip to content

Commit

Permalink
fixbug-table_user
Browse files Browse the repository at this point in the history
  • Loading branch information
bingxindan committed Jul 10, 2023
1 parent 5af4292 commit 3587edd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion store/postgresql/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ func (u *groupStore) getGroupLinkUserIds(groupId string) (map[string]struct{}, e
ids := make(map[string]struct{})

// 拉取该分组下的所有 user
idRows, err := u.slave.Query("SELECT user_id FROM user u JOIN user_group_relation ug ON "+
idRows, err := u.slave.Query("SELECT user_id FROM \"user\" u JOIN user_group_relation ug ON "+
" u.id = ug.user_id WHERE ug.group_id = $1", groupId)
if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions store/postgresql/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (u *userStore) deleteUser(user *model.User) error {
// GetSubCount get user's sub count
func (u *userStore) GetSubCount(user *model.User) (uint32, error) {
var (
countSql = "SELECT COUNT(*) FROM user WHERE owner = $1 AND flag = 0"
countSql = "SELECT COUNT(*) FROM \"user\" WHERE owner = $1 AND flag = 0"
count, err = queryEntryCount(u.master, countSql, []interface{}{user.ID})
)

Expand Down Expand Up @@ -324,7 +324,7 @@ func (u *userStore) GetUserByIds(ids []string) ([]*model.User, error) {

getSql := "SELECT u.id, u.name, u.password, u.owner, u.comment, u.source, " +
"u.token, u.token_enable, u.user_type, u.ctime , u.mtime, u.flag, u.mobile, " +
"u.email FROM user u WHERE u.flag = 0 AND u.id IN ("
"u.email FROM \"user\" u WHERE u.flag = 0 AND u.id IN ("

var idx = 1

Expand Down Expand Up @@ -377,9 +377,9 @@ func (u *userStore) GetUsers(filters map[string]string, offset uint32, limit uin
// listUsers Query user list information
func (u *userStore) listUsers(filters map[string]string, offset uint32, limit uint32) (uint32,
[]*model.User, error) {
countSql := "SELECT COUNT(*) FROM user WHERE flag = 0 "
countSql := "SELECT COUNT(*) FROM \"user\" WHERE flag = 0 "
getSql := "SELECT id, name, password, owner, comment, source, token, token_enable, " +
"user_type, ctime, mtime, flag, mobile, email FROM user WHERE flag = 0"
"user_type, ctime, mtime, flag, mobile, email FROM \"user\" WHERE flag = 0"

if val, ok := filters["hide_admin"]; ok && val == "true" {
delete(filters, "hide_admin")
Expand Down

0 comments on commit 3587edd

Please sign in to comment.