From 2e7c6c4afbdd0251a9fca2879f0379f2f02cbcb5 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 11:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2725=20:=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=90=9C=E7=B4=A2--=E9=BB=98=E8=AE=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E5=92=8C=E5=A7=93=E5=90=8D=E4=B8=80=E8=B5=B7?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users_service.rb | 4 +++- app/views/users/search.html.erb | 4 ++-- app/views/welcome/_search_project.html.erb | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/services/users_service.rb b/app/services/users_service.rb index aff0a975c..7e8e775ed 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -255,7 +255,9 @@ class UsersService watcher.push(params[:user_id]) scope = scope.where("id not in (?)",watcher) end - scope = scope.like(params[:name],search_by) + #scope = scope.like(params[:name],search_by) + scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )", + "%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%") end #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end else diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index ef1db3b0c..13979f79f 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -30,8 +30,8 @@ <%#= hidden_field_tag 'project_type', project_type %>