添加合作者分页

dev_forum
daiao 5 years ago
parent 54196a44c5
commit 4efa98153f

@ -627,9 +627,11 @@ class ShixunsController < ApplicationController
user_name = "%#{params[:user_name].to_s.strip}%" user_name = "%#{params[:user_name].to_s.strip}%"
school_name = "%#{params[:school_name].to_s.strip}%" school_name = "%#{params[:school_name].to_s.strip}%"
if user_name.present? || school_name.present? 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 @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 LOWER(users.lastname) LIKE '#{user_name}' AND LOWER(schools.name) LIKE
'#{school_name}'").limit(20) '#{school_name}'").page(page).per(limit)
else else
@users = User.none @users = User.none
end end

Loading…
Cancel
Save