修改用户搜索无法精确搜索的bUG
This commit is contained in:
parent
3caf5c8657
commit
b512bc53e9
|
@ -377,7 +377,7 @@ class UsersController < ApplicationController
|
||||||
}
|
}
|
||||||
scope = User.logged.status(@status)
|
scope = User.logged.status(@status)
|
||||||
@search_by = params[:search_by] ? params[:search_by][:id] : 0
|
@search_by = params[:search_by] ? params[:search_by][:id] : 0
|
||||||
scope = scope.like(params[:name],@search_by) if params[:name].present?
|
scope = scope.like(params[:name],"0") if params[:name].present?
|
||||||
@user_count = scope.count
|
@user_count = scope.count
|
||||||
@user_pages = Paginator.new @user_count, @limit, params['page']
|
@user_pages = Paginator.new @user_count, @limit, params['page']
|
||||||
@user_base_tag = params[:id] ? 'base_users':'users_base'
|
@user_base_tag = params[:id] ? 'base_users':'users_base'
|
||||||
|
|
|
@ -206,11 +206,11 @@ class User < Principal
|
||||||
pattern = "%#{arg.to_s.strip.downcase}%"
|
pattern = "%#{arg.to_s.strip.downcase}%"
|
||||||
#where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
|
#where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
|
||||||
if type == "0"
|
if type == "0"
|
||||||
where(" LOWER(login) LIKE :p ", :p => pattern)
|
where(" LOWER(login) LIKE '#{pattern}' ")
|
||||||
elsif type == "1"
|
elsif type == "1"
|
||||||
where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
|
where(" LOWER(concat(lastname, firstname)) LIKE '#{pattern}' ")
|
||||||
else
|
else
|
||||||
where(" LOWER(mail) LIKE :p ", :p => pattern)
|
where(" LOWER(mail) LIKE '#{pattern}' ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue