fixed 项目列表支持多个标签名称查询
This commit is contained in:
parent
233642d903
commit
19c2367257
|
@ -7,6 +7,7 @@ module Matchable
|
|||
scope :with_project_type, ->(project_type) { where(project_type: project_type) if Project.project_types.include?(project_type) }
|
||||
scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "%#{search.split(" ").join('|')}%") unless search.blank? }
|
||||
scope :with_project_topic, ->(topic_id) {joins(:project_topics).where(project_topics: {id: topic_id}) unless topic_id.blank?}
|
||||
scope :with_project_topic_name, ->(topic_name) {joins(:project_topics).where(project_topics: {name: topic_name}) unless topic_name.blank?}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -77,7 +77,11 @@ class Projects::ListQuery < ApplicationQuery
|
|||
end
|
||||
|
||||
def by_project_topic(items)
|
||||
items.with_project_topic(params[:topic_id])
|
||||
if params[:topic_name].present?
|
||||
items.with_project_topic_name(params[:topic_name].to_s.split(","))
|
||||
else
|
||||
items.with_project_topic(params[:topic_id])
|
||||
end
|
||||
end
|
||||
|
||||
# 优化排序
|
||||
|
|
Loading…
Reference in New Issue