From 56ae1cd12a7a3a92563bcbf5583f659c5ad5eee5 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 목, 27 1월 2022 15:42:59 +0900
Subject: [PATCH] - 상위 이슈 검색시 하위 이슈는 검색 제외 및 프로젝트 설정 해야 상위이슈 선택 가능하도록 수정

---
 src/main/webapp/scripts/components/utils/autoComplete.controller.js |   49 ++++++++++++++++++++++++
 src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java    |   13 ++++++
 src/main/webapp/scripts/components/issue/issue.service.js           |    6 +++
 src/main/resources/mybatis/query-template/issue-template.xml        |    4 ++
 src/main/webapp/i18n/ko/global.json                                 |    1 
 src/main/webapp/views/issue/issueDetail.html                        |    2 
 src/main/webapp/views/issue/issueExcelImport.html                   |    2 
 src/main/webapp/scripts/app/issue/issueImportExcel.controller.js    |    4 ++
 8 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java b/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
index befe420..ae863c5 100644
--- a/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
+++ b/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
@@ -59,6 +59,7 @@
     private Pageable downPageable;
     private Boolean allIssue; // �쟾泥댁씠�뒋 蹂댁뿬二쇨린
     private Long issueTypeId;
+    private Boolean parentYN;   //�긽�쐞�씠�뒋留� 議고쉶 �쑀臾�
 
     public IssueCondition(){}
 
@@ -219,6 +220,10 @@
             condition.setTree(MapUtil.getBoolean(conditions, "isTree"));
         } else {
             condition.setTree(false);
+        }
+
+        if (MapUtil.getBoolean(conditions, "parentYN") != null && MapUtil.getBoolean(conditions, "parentYN")) {
+            condition.setParentYN(true);
         }
 
         return condition;
@@ -595,4 +600,12 @@
     public void setIssueTypeId(Long issueTypeId) {
         this.issueTypeId = issueTypeId;
     }
+
+    public Boolean getParentYN() {
+        return parentYN;
+    }
+
+    public void setParentYN(Boolean parentYN) {
+        this.parentYN = parentYN;
+    }
 }
diff --git a/src/main/resources/mybatis/query-template/issue-template.xml b/src/main/resources/mybatis/query-template/issue-template.xml
index cf64f38..d220849 100644
--- a/src/main/resources/mybatis/query-template/issue-template.xml
+++ b/src/main/resources/mybatis/query-template/issue-template.xml
@@ -142,6 +142,10 @@
             AND issue_status.issue_status_type != 'CLOSE'
         </if>
 
+        <if test="parentYN != null and parentYN == true">
+            AND issue.parent_issue_id IS NULL
+        </if>
+
         <choose>
             <when test="projectIds.size != 0">
                 AND project.id IN
diff --git a/src/main/webapp/i18n/ko/global.json b/src/main/webapp/i18n/ko/global.json
index 27b57df..e70ed71 100644
--- a/src/main/webapp/i18n/ko/global.json
+++ b/src/main/webapp/i18n/ko/global.json
@@ -879,6 +879,7 @@
         "failedToProjectListLookUp": "�봽濡쒖젥�듃 紐⑸줉 議고쉶 �떎�뙣",
         "failedToWorkflowListLookUp": "�썙�겕�뵆濡쒖슦 紐⑸줉 議고쉶 �떎�뙣",
         "failedToIssueListLookUp": "�씠�뒋 紐⑸줉 議고쉶 �떎�뙣",
+        "selectToProjectListLookUp": "�봽濡쒖젥�듃瑜� 癒쇱� �꽑�깮 �빐 二쇱꽭�슂.",
         "failedToCompanyCategoryListLookUp": "�뾽泥� 移댄뀒怨좊━ 紐⑸줉 議고쉶 �떎�뙣",
         "title": "�젣紐�",
         "number": "踰덊샇",
diff --git a/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js b/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
index 555dd12..fd718ff 100644
--- a/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
@@ -31,6 +31,10 @@
                     },
                     projectName : "",
                     autoCompletePage : {
+                        issue : {
+                            page : 0,
+                            totalPage : 0
+                        },
                         project : {
                             page : 0,
                             totalPage : 0
diff --git a/src/main/webapp/scripts/components/issue/issue.service.js b/src/main/webapp/scripts/components/issue/issue.service.js
index a01b309..7794fd3 100644
--- a/src/main/webapp/scripts/components/issue/issue.service.js
+++ b/src/main/webapp/scripts/components/issue/issue.service.js
@@ -33,6 +33,12 @@
                     return response;
                 });
             },
+            findParentIssue : function (conditions) {
+                return $http.post("issue/findParentIssue", conditions).then(function (response) {
+                    $log.debug("�긽�쐞�씠�뒋 紐⑸줉 �뜲�씠�꽣 : ", response);
+                    return response;
+                });
+            },
             findPartners : function (conditions) {
                 return $http.post("issue/findPartner", conditions).then(function (response) {
                     $log.debug("�궗�슜�븯�뒗 �뙆�듃�꼫 紐⑸줉 �뜲�씠�꽣 : ", response);
diff --git a/src/main/webapp/scripts/components/utils/autoComplete.controller.js b/src/main/webapp/scripts/components/utils/autoComplete.controller.js
index 9e39aa1..a2e3381 100644
--- a/src/main/webapp/scripts/components/utils/autoComplete.controller.js
+++ b/src/main/webapp/scripts/components/utils/autoComplete.controller.js
@@ -33,6 +33,7 @@
                 $scope.fn.getUserList = getUserList;    //  �궗�슜�옄 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
                 $scope.fn.getProjectList = getProjectList;  //  �봽濡쒖젥�듃 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
                 $scope.fn.getIssueList = getIssueList;  //  �씪媛� 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
+                $scope.fn.getParentIssueList = getParentIssueList;   // �긽�쐞 �씠�뒋 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
                 $scope.fn.getRelIssueList = getRelIssueList;   // �뿰愿� �씠�뒋 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
                 $scope.fn.getDownIssueList = getDownIssueList;  //  �븯�쐞 �씠�뒋 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
                 $scope.fn.getWorkflowList = getWorkflowList;    //  �썙�겕�뵆濡쒖슦 紐⑸줉 �젙蹂대�� 議고쉶�븳�떎.
@@ -175,7 +176,7 @@
                     return deferred.promise;
                 }
 
-                function getRelIssueList(query, issueTypeId, excludeList, page, callBack) {
+                function getParentIssueList(query, issueTypeId, excludeList, page, callBack) {
                     var conditions = {
                         name : query,
                         excludeIds : (function () {
@@ -210,6 +211,52 @@
                     return deferred.promise;
                 }
 
+                function getRelIssueList(parentYN, project, query, issueTypeId, excludeList, page, callBack) {
+                    var conditions = {
+                        name : query,
+                        excludeIds : (function () {
+                            var excludeIds = [];
+
+                            angular.forEach(excludeList, function (exclude) {
+                                excludeIds.push(exclude.id);
+                            });
+                            return excludeIds;
+                        })(),
+                        parentYN : parentYN,
+                        projectIds : (function () {
+                            var projectIds = [];
+                            if (project != null) {
+                                if (project.length < 1) {
+                                    SweetAlert.swal($filter("translate")("common.failedToIssueListLookUp"), $filter("translate")("common.selectToProjectListLookUp"), "error"); // "�봽濡쒖젥�듃瑜� 癒쇱� �꽑�깮 �빐 二쇱꽭�슂."
+                                }
+                                projectIds.push(project[0].id);
+                            }
+                            return projectIds;
+                        })()
+                    };
+
+                    var deferred = $q.defer();
+
+                    if ($rootScope.isDefined(page) && page > 0) {
+                        $rootScope.spinner = true;
+                    }
+
+                    Issue.find($resourceProvider.getContent(
+                        conditions, $resourceProvider.getPageContent($rootScope.isDefined(page) ? page : 0, $rootScope.isDefined(page) ? 10 : 25))).then(function (result) {
+                        if (result.data.message.status === "success") {
+                            if ($rootScope.isDefined(callBack)) {
+                                callBack(result);
+                            }
+                            deferred.resolve(result.data.data);
+                        }
+                        else {
+                            SweetAlert.swal($filter("translate")("common.failedToIssueListLookUp"), result.data.message.message, "error"); // "�썙�겕�뵆濡쒖슦 紐⑸줉 議고쉶 �떎�뙣"
+                        }
+                        $rootScope.spinner = false;
+                    });
+                    return deferred.promise;
+                }
+
                 function getDownIssueList(query, issueTypeId, parentIssueId, excludeList, page, callBack) {
                     var conditions = {
                         name : query,
diff --git a/src/main/webapp/views/issue/issueDetail.html b/src/main/webapp/views/issue/issueDetail.html
index c86c85d..2468131 100644
--- a/src/main/webapp/views/issue/issueDetail.html
+++ b/src/main/webapp/views/issue/issueDetail.html
@@ -616,7 +616,7 @@
                             <js-autocomplete-single data-input-name="issue"
                                                     selected-model="vm.form.issues"
                                                     search="vm.issueName"
-                                                    source="fn.getRelIssueList(vm.issueName, vm.issueTypeId, vm.form.issues, vm.autoCompletePage.issue.page, fn.getIssueListCallBack)"
+                                                    source="fn.getRelIssueList(false, null, vm.issueName, vm.issueTypeId, vm.form.issues, vm.autoCompletePage.issue.page, fn.getIssueListCallBack)"
                                                     page="vm.autoCompletePage.issue.page"
                                                     total-page="vm.autoCompletePage.issue.totalPage"
                                                     input-disabled="false"
diff --git a/src/main/webapp/views/issue/issueExcelImport.html b/src/main/webapp/views/issue/issueExcelImport.html
index 8c32bf1..d0d1d9c 100644
--- a/src/main/webapp/views/issue/issueExcelImport.html
+++ b/src/main/webapp/views/issue/issueExcelImport.html
@@ -31,7 +31,7 @@
                     <js-autocomplete-single data-input-name="issue"
                                             selected-model="vm.form.issues"
                                             search="vm.issueName"
-                                            source="fn.getRelIssueList(vm.issueName, vm.issueTypeId, vm.form.issues, vm.autoCompletePage.issue.page, fn.getIssueListCallBack)"
+                                            source="fn.getRelIssueList(true, vm.form.projects, vm.issueName, vm.issueTypeId, vm.form.issues, vm.autoCompletePage.issue.page, fn.getIssueListCallBack)"
                                             page="vm.autoCompletePage.issue.page"
                                             total-page="vm.autoCompletePage.issue.totalPage"
                                             input-disabled="false"

--
Gitblit v1.8.0