enhance(user):更改用户检索中like的定义方式。
This commit is contained in:
parent
097e25f070
commit
f8ef6aba98
|
@ -271,16 +271,16 @@ func (ur _UserRepository) FindUser(keyword *string, userType int16, state *bool,
|
|||
pattern := fmt.Sprintf("%%%s%%", *keyword)
|
||||
userQuery = userQuery.Where(
|
||||
goqu.Or(
|
||||
goqu.Ex{"u.username": goqu.Op{"like": pattern}},
|
||||
goqu.Ex{"ud.name": goqu.Op{"like": pattern}},
|
||||
goqu.Ex{"ud.abbr": goqu.Op{"like": pattern}},
|
||||
goqu.I("u.username").ILike(pattern),
|
||||
goqu.I("ud.name").ILike(pattern),
|
||||
goqu.I("ud.abbr").ILike(pattern),
|
||||
),
|
||||
)
|
||||
countQuery = countQuery.Where(
|
||||
goqu.Or(
|
||||
goqu.Ex{"u.username": goqu.Op{"like": pattern}},
|
||||
goqu.Ex{"ud.name": goqu.Op{"like": pattern}},
|
||||
goqu.Ex{"ud.abbr": goqu.Op{"like": pattern}},
|
||||
goqu.I("u.username").ILike(pattern),
|
||||
goqu.I("ud.name").ILike(pattern),
|
||||
goqu.I("ud.abbr").ILike(pattern),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
@ -428,9 +428,9 @@ func (ur _UserRepository) SearchUsersWithLimit(userType *int16, keyword *string,
|
|||
pattern := fmt.Sprintf("%%%s%%", *keyword)
|
||||
userQuery = userQuery.Where(
|
||||
goqu.Or(
|
||||
goqu.Ex{"u.username": goqu.Op{"like": pattern}},
|
||||
goqu.Ex{"ud.name": goqu.Op{"like": pattern}},
|
||||
goqu.Ex{"ud.abbr": goqu.Op{"like": pattern}},
|
||||
goqu.I("u.username").ILike(pattern),
|
||||
goqu.I("ud.name").ILike(pattern),
|
||||
goqu.I("ud.abbr").ILike(pattern),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user