From 71a5ce92795fb1a4fbff5fceab8135ec98a691e5 Mon Sep 17 00:00:00 2001
From: 박지현 <jhpark@maprex.co.kr>
Date: 월, 07 3월 2022 18:07:52 +0900
Subject: [PATCH] 이슈 목록 조회 방식 - 전체이슈 보기 / 상위 이슈만 보기 / 하위 이슈만 보기로 수정

---
 src/main/resources/mybatis/query-template/issue-template.xml |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mybatis/query-template/issue-template.xml b/src/main/resources/mybatis/query-template/issue-template.xml
index cf64f38..8392915 100644
--- a/src/main/resources/mybatis/query-template/issue-template.xml
+++ b/src/main/resources/mybatis/query-template/issue-template.xml
@@ -22,6 +22,7 @@
         project.project_key as projectKey,
         issue_type.id as issueTypeId,
         issue_type.name as issueTypeName,
+        issue_type.inherit_partners as inheritPartners,
         issue_status.id as issueStatusId,
         issue_status.issue_status_type as issueStatusType,
         issue_status.name as issueStatusName,
@@ -35,6 +36,7 @@
         ic.name AS companyName,
         ii.name AS ispName,
         ih.name AS hostingName,
+        d.department_name AS departmentName,
         GROUP_CONCAT(issue_custom.use_value) AS useValue,
         IFNULL(temp_attached_file.attachedFileCount, 0) as attachedFileCount,
         IFNULL(temp_issue_comment.issueCommentCount, 0) as issueCommentCount
@@ -132,14 +134,26 @@
             ANd issue.complete_date <![CDATA[ <= ]]> #{endCompleteDate}
         </if>
 
+        <if test="beginDateRange != null and !beginDateRange.equals('') and endDateRange != null and !endDateRange.equals('')">
+            AND (issue.start_date BETWEEN #{beginDateRange} AND #{endDateRange} OR issue.complete_date BETWEEN #{beginDateRange} AND #{endDateRange})
+        </if>
+
         <if test="combinationIssueNumber == null or combinationIssueNumber.equals('')">
-            <if test="hideDownIssue != null and hideDownIssue == true">
+            <if test="hideDownIssue != null and hideDownIssue == true and parentYN == true">
                 AND issue.parent_issue_id IS NULL
             </if>
         </if>
 
         <if test="hideCompleteIssue != null and hideCompleteIssue == true">
             AND issue_status.issue_status_type != 'CLOSE'
+        </if>
+
+        <if test="parentYN != null and parentYN == true and hideDownIssue == true">
+            AND issue.parent_issue_id IS NULL
+        </if>
+
+        <if test="hideDownIssue == false and parentYN == false">
+            AND issue.parent_issue_id IS NOT NULL
         </if>
 
         <choose>
@@ -345,10 +359,18 @@
             ANd issue.complete_date <![CDATA[ <= ]]> #{endCompleteDate}
         </if>
 
+        <if test="beginDateRange != null and !beginDateRange.equals('') and endDateRange != null and !endDateRange.equals('')">
+            AND (issue.start_date BETWEEN #{beginDateRange} AND #{endDateRange} OR issue.complete_date BETWEEN #{beginDateRange} AND #{endDateRange})
+        </if>
+
         <if test="combinationIssueNumber == null or combinationIssueNumber.equals('')">
-            <if test="hideDownIssue != null and hideDownIssue == true">
+            <if test="hideDownIssue != null and hideDownIssue == true and parentYN == true">
                 AND issue.parent_issue_id IS NULL
             </if>
+        </if>
+
+        <if test="hideDownIssue == false and parentYN == false">
+            AND issue.parent_issue_id IS NOT NULL
         </if>
 
         <if test="hideCompleteIssue != null and hideCompleteIssue == true">
@@ -626,13 +648,13 @@
 
     <insert id="insertBatch" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
         INSERT INTO issue(title, description, issue_number, project_id, issue_type_id, priority_id, severity_id,
-        start_date, complete_date,
+        start_date, complete_date, parent_issue_id,
         issue_status_id, register_id, modify_id, register_date, modify_date)
         VALUES
         <foreach collection="list" item="issueForm" index="index" separator="," open="" close="">
             (#{issueForm.title}, #{issueForm.description}, #{issueForm.issueNumber}, #{issueForm.projectId},
             #{issueForm.issueTypeId}, #{issueForm.priorityId}, #{issueForm.severityId}, #{issueForm.startDate},
-            #{issueForm.completeDate},
+            #{issueForm.completeDate}, #{issueForm.parentIssueId},
             #{issueForm.issueStatusId}, #{issueForm.registerId}, #{issueForm.registerId}, NOW(), NOW())
         </foreach>
     </insert>

--
Gitblit v1.8.0