课程/项目--添加成员:用真实姓名搜索用户时,需要在姓和名之间加个空格才可以搜到
This commit is contained in:
parent
c60515ac50
commit
81cbb76d78
|
@ -42,7 +42,8 @@ class Principal < ActiveRecord::Base
|
|||
where({})
|
||||
else
|
||||
pattern = "%#{q}%"
|
||||
sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ")
|
||||
# sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ")
|
||||
sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p)"
|
||||
params = {:p => pattern}
|
||||
if q =~ /^(.+)\s+(.+)$/
|
||||
a, b = "#{$1}%", "#{$2}%"
|
||||
|
|
Loading…
Reference in New Issue