issue按id集合查询,选择关联issue时排除已选id集合
This commit is contained in:
parent
1bdb6dad98
commit
b13f1a681e
|
@ -145,7 +145,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
|
||||||
:begin_date, :end_date,
|
:begin_date, :end_date,
|
||||||
:sort_by, :sort_direction, :root_id,
|
:sort_by, :sort_direction, :root_id,
|
||||||
:issue_tag_ids, :pm_project_id, :pm_sprint_id, :pm_issue_type,
|
:issue_tag_ids, :pm_project_id, :pm_sprint_id, :pm_issue_type,
|
||||||
:status_ids, :ids
|
:status_ids, :ids, :exclude_ids
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Api::V1::Issues::ListService < ApplicationService
|
||||||
attr_reader :project, :only_name, :category, :participant_category, :keyword, :author_id, :issue_tag_ids
|
attr_reader :project, :only_name, :category, :participant_category, :keyword, :author_id, :issue_tag_ids
|
||||||
attr_reader :begin_date, :end_date
|
attr_reader :begin_date, :end_date
|
||||||
attr_reader :milestone_id, :assigner_id, :status_id, :sort_by, :sort_direction, :current_user
|
attr_reader :milestone_id, :assigner_id, :status_id, :sort_by, :sort_direction, :current_user
|
||||||
attr_reader :pm_project_id, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids
|
attr_reader :pm_project_id, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids, :ids, :exclude_ids
|
||||||
attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count, :complete_issues_count
|
attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count, :complete_issues_count
|
||||||
|
|
||||||
validates :category, inclusion: { in: %w[all opened closed], message: '请输入正确的Category'}
|
validates :category, inclusion: { in: %w[all opened closed], message: '请输入正确的Category'}
|
||||||
|
@ -31,6 +31,8 @@ class Api::V1::Issues::ListService < ApplicationService
|
||||||
@pm_sprint_id = params[:pm_sprint_id]
|
@pm_sprint_id = params[:pm_sprint_id]
|
||||||
@root_id = params[:root_id]
|
@root_id = params[:root_id]
|
||||||
@pm_issue_type = params[:pm_issue_type]
|
@pm_issue_type = params[:pm_issue_type]
|
||||||
|
@ids = params[:ids]
|
||||||
|
@exclude_ids = params[:exclude_ids]
|
||||||
@status_ids = params[:status_ids].present? ? params[:status_ids].split(',') : []
|
@status_ids = params[:status_ids].present? ? params[:status_ids].split(',') : []
|
||||||
@sort_direction = (params[:sort_direction].present? ? params[:sort_direction] : 'desc').downcase
|
@sort_direction = (params[:sort_direction].present? ? params[:sort_direction] : 'desc').downcase
|
||||||
@current_user = current_user
|
@current_user = current_user
|
||||||
|
@ -105,10 +107,10 @@ class Api::V1::Issues::ListService < ApplicationService
|
||||||
issues = issues.where(status_id: status_ids) unless status_ids.blank?
|
issues = issues.where(status_id: status_ids) unless status_ids.blank?
|
||||||
|
|
||||||
# ids
|
# ids
|
||||||
issues = issues.where(id: params[:ids].to_s.split(",")) if params[:ids].present?
|
issues = issues.where(id: ids.to_s.split(",")) if ids.present?
|
||||||
|
|
||||||
# exclude_ids
|
# exclude_ids
|
||||||
issues = issues.where.not(id: params[:exclude_ids].to_s.split(",")) if params[:exclude_ids].present?
|
issues = issues.where.not(id: exclude_ids.to_s.split(",")) if exclude_ids.present?
|
||||||
|
|
||||||
if begin_date&.present? || end_date&.present?
|
if begin_date&.present? || end_date&.present?
|
||||||
issues = issues.where('issues.created_on between ? and ?', begin_date&.present? ? begin_date.to_time : Time.now.beginning_of_day, end_date&.present? ? end_date.to_time.end_of_day : Time.now.end_of_day)
|
issues = issues.where('issues.created_on between ? and ?', begin_date&.present? ? begin_date.to_time : Time.now.beginning_of_day, end_date&.present? ? end_date.to_time.end_of_day : Time.now.end_of_day)
|
||||||
|
|
Loading…
Reference in New Issue