|
|
|
@ -19,6 +19,11 @@ class Weapps::SubjectQuery < ApplicationQuery
|
|
|
|
|
subjects = subjects.joins(:sub_discipline_containers).where(sub_discipline_containers: {container_type: "Subject"})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 搜索
|
|
|
|
|
if params[:keyword].present?
|
|
|
|
|
subjects = subjects.where("subjects.name like '%#{params[:keyword]}%'")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
subjects = subjects.left_joins(:shixuns, :repertoire).select('subjects.id, subjects.name, subjects.excellent, subjects.stages_count, subjects.status, subjects.homepage_show,
|
|
|
|
|
subjects.shixuns_count, subjects.repertoire_id, subjects.updated_at, IFNULL(sum(shixuns.myshixuns_count), 0) myshixuns_count')
|
|
|
|
|
.group('subjects.id').order("subjects.homepage_show #{sort_type}, #{order_type} #{sort_type}")
|
|
|
|
|