Browse Source

issue按id集合查询,选择关联issue时排除已选id集合

pull/347/head
xxq250 2 years ago
parent
commit
1bdb6dad98
2 changed files with 7 additions and 6 deletions
  1. +0
    -2
      app/controllers/api/pm/issues_controller.rb
  2. +7
    -4
      app/services/api/v1/issues/list_service.rb

+ 0
- 2
app/controllers/api/pm/issues_controller.rb View File

@@ -29,8 +29,6 @@ class Api::Pm::IssuesController < Api::Pm::BaseController
@issue.pm_links.pluck(:be_linkable_id)
end

not_join_id = params[:exclude_ids].to_s.split(",") if params[:exclude_ids].present?

not_join_id << @issue.id
object_issues = Issue.where(
pm_project_id: params[:pm_project_id],


+ 7
- 4
app/services/api/v1/issues/list_service.rb View File

@@ -76,9 +76,6 @@ class Api::V1::Issues::ListService < ApplicationService
# milestone_id
issues = issues.where(fixed_version_id: milestone_id) if milestone_id.present?

# ids
issues = issues.where(id: params[:ids].to_s.split(",")) if params[:ids].present?

#pm相关
# root_id# -1 查一级目录
issues = if root_id.to_i == -1
@@ -105,7 +102,13 @@ class Api::V1::Issues::ListService < ApplicationService
issues = issues.where(status_id: status_id) if status_id.present? && category != 'closed'

# status_ids
issues = issues.where(status_id: status_ids) unless status_ids.blank?
issues = issues.where(status_id: status_ids) unless status_ids.blank?

# ids
issues = issues.where(id: params[:ids].to_s.split(",")) if params[:ids].present?

# exclude_ids
issues = issues.where.not(id: params[:exclude_ids].to_s.split(",")) if params[:exclude_ids].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)


Loading…
Cancel
Save