fix: 查询like使用字符串拼接替代concat
This commit is contained in:
@@ -20,10 +20,10 @@ func (r SysLogLogin) SelectByPage(query map[string]string, dataScopeSQL string)
|
||||
tx := db.DB("").Model(&model.SysLogLogin{})
|
||||
// 查询条件拼接
|
||||
if v, ok := query["loginIp"]; ok && v != "" {
|
||||
tx = tx.Where("login_ip like concat(?, '%')", v)
|
||||
tx = tx.Where("login_ip like ?", fmt.Sprintf("%s%%", v))
|
||||
}
|
||||
if v, ok := query["userName"]; ok && v != "" {
|
||||
tx = tx.Where("user_name like concat(?, '%')", v)
|
||||
tx = tx.Where("user_name like ?", fmt.Sprintf("%s%%", v))
|
||||
}
|
||||
if v, ok := query["statusFlag"]; ok && v != "" {
|
||||
tx = tx.Where("status_flag = ?", v)
|
||||
|
||||
Reference in New Issue
Block a user