超级管理员的课堂列表增加按课堂名称搜索

pre_develop
cxt 6 years ago
parent 58bf8a9947
commit ecff82dc0c

@ -2023,7 +2023,7 @@ end
# @schools = School.where(:id =>user_exs.map(&:school_id)) # @schools = School.where(:id =>user_exs.map(&:school_id))
# end # end
@search = params[:search] # 搜索字 @search = params[:search] # 搜索字
@keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 @keyword = params[:keyword].blank? ? "c_name" : params[:keyword] # 根据姓名/课程名搜索
@status = params[:status] @status = params[:status]
@school_id = params[:school_id] @school_id = params[:school_id]
@ -2044,11 +2044,13 @@ end
if params[:status] && params[:status]!='' if params[:status] && params[:status]!=''
@courses = @courses.where(:is_end => @status.to_i) @courses = @courses.where(:is_end => @status.to_i)
end end
if "u_name" == @keyword if "c_name" == @keyword
@courses = @courses.where("name like ?", "%#{@search}%")
elsif "u_name" == @keyword
if @search.blank? if @search.blank?
@courses = @courses @courses = @courses
else else
user_id = User.where("concat(lastname, firstname) like '%#{@search}%'") # user_id = User.where("concat(lastname, firstname) like '%#{@search}%'")
@courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'") @courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'")
end end
elsif "dep_name" == @keyword elsif "dep_name" == @keyword

@ -14,6 +14,7 @@
</div> </div>
<select class="task-form-15 task-height-30 fl" style="margin:0px 0px 0px 25px;width: 11%" name="keyword" id="condition_status"> <select class="task-form-15 task-height-30 fl" style="margin:0px 0px 0px 25px;width: 11%" name="keyword" id="condition_status">
<option value="c_name">课堂名称搜索</option>
<option value="u_name">创建者姓名搜索</option> <option value="u_name">创建者姓名搜索</option>
<option value="dep_name">创建者单位搜索</option> <option value="dep_name">创建者单位搜索</option>
</select> </select>

Loading…
Cancel
Save