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)
|
pattern := fmt.Sprintf("%%%s%%", *keyword)
|
||||||
userQuery = userQuery.Where(
|
userQuery = userQuery.Where(
|
||||||
goqu.Or(
|
goqu.Or(
|
||||||
goqu.Ex{"u.username": goqu.Op{"like": pattern}},
|
goqu.I("u.username").ILike(pattern),
|
||||||
goqu.Ex{"ud.name": goqu.Op{"like": pattern}},
|
goqu.I("ud.name").ILike(pattern),
|
||||||
goqu.Ex{"ud.abbr": goqu.Op{"like": pattern}},
|
goqu.I("ud.abbr").ILike(pattern),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
countQuery = countQuery.Where(
|
countQuery = countQuery.Where(
|
||||||
goqu.Or(
|
goqu.Or(
|
||||||
goqu.Ex{"u.username": goqu.Op{"like": pattern}},
|
goqu.I("u.username").ILike(pattern),
|
||||||
goqu.Ex{"ud.name": goqu.Op{"like": pattern}},
|
goqu.I("ud.name").ILike(pattern),
|
||||||
goqu.Ex{"ud.abbr": goqu.Op{"like": pattern}},
|
goqu.I("ud.abbr").ILike(pattern),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -428,9 +428,9 @@ func (ur _UserRepository) SearchUsersWithLimit(userType *int16, keyword *string,
|
||||||
pattern := fmt.Sprintf("%%%s%%", *keyword)
|
pattern := fmt.Sprintf("%%%s%%", *keyword)
|
||||||
userQuery = userQuery.Where(
|
userQuery = userQuery.Where(
|
||||||
goqu.Or(
|
goqu.Or(
|
||||||
goqu.Ex{"u.username": goqu.Op{"like": pattern}},
|
goqu.I("u.username").ILike(pattern),
|
||||||
goqu.Ex{"ud.name": goqu.Op{"like": pattern}},
|
goqu.I("ud.name").ILike(pattern),
|
||||||
goqu.Ex{"ud.abbr": goqu.Op{"like": pattern}},
|
goqu.I("ud.abbr").ILike(pattern),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user