|
|
|
@ -623,19 +623,22 @@ class ShixunsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def add_collaborators
|
|
|
|
|
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
|
|
|
|
|
user_name = "%#{params[:user_name].to_s.strip}%"
|
|
|
|
|
school_name = "%#{params[:school_name].to_s.strip}%"
|
|
|
|
|
if user_name.present? || school_name.present?
|
|
|
|
|
page = params[:page] || 1
|
|
|
|
|
limit = params[:limit] || 20
|
|
|
|
|
@users = User.joins(user_extension: :school).where("users.id not in #{member_ids} AND users.status = 1 AND
|
|
|
|
|
member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")"
|
|
|
|
|
user_name = "%#{params[:user_name].to_s.strip}%"
|
|
|
|
|
school_name = "%#{params[:school_name].to_s.strip}%"
|
|
|
|
|
if user_name.present? || school_name.present?
|
|
|
|
|
@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}'").distinct.page(page).per(limit)
|
|
|
|
|
else
|
|
|
|
|
@users = User.none
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
'#{school_name}'")
|
|
|
|
|
else
|
|
|
|
|
@users = User.none
|
|
|
|
|
end
|
|
|
|
|
page = params[:page] || 1
|
|
|
|
|
limit = params[:limit] || 20
|
|
|
|
|
@users_count = @users.count
|
|
|
|
|
@users = @users.page(page).per(limit)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def shixun_members_added
|
|
|
|
|
raise("user_ids 不能为空!") if params[:user_ids].blank?
|
|
|
|
|