|
|
@ -624,8 +624,11 @@ class ShixunsController < ApplicationController
|
|
|
|
def add_collaborators
|
|
|
|
def add_collaborators
|
|
|
|
raise("搜索内容不能为空") unless params[:search]
|
|
|
|
raise("搜索内容不能为空") unless params[:search]
|
|
|
|
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
|
|
|
|
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
|
|
|
|
condition = "%#{params[:search].strip}%".gsub(" ","")
|
|
|
|
user_name = "%#{params[:user_name].strip}%"
|
|
|
|
@users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname, login, mail, nickname)) LIKE '#{condition}'")
|
|
|
|
school_name = "%#{params[:school_name].strip}%"
|
|
|
|
|
|
|
|
@users = User.joins(user_extension: :school).where("users.id not in #{member_ids} AND users.status = 1 AND
|
|
|
|
|
|
|
|
LOWER(users.lastname) LIKE '#{user_name}' AND LOWER(schools.name) LIKE
|
|
|
|
|
|
|
|
'#{school_name}' ")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def shixun_members_added
|
|
|
|
def shixun_members_added
|
|
|
|