From fab2f56f5631335d5ac5b1497fa996fbe63d0b1f Mon Sep 17 00:00:00 2001
From: jhjang <jhjang@maprex.co.kr>
Date: 화, 11 1월 2022 14:45:33 +0900
Subject: [PATCH] - 이슈 검색 속도 개선

---
 src/main/resources/mybatis/query-template/issueType-template.xml |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mybatis/query-template/issueType-template.xml b/src/main/resources/mybatis/query-template/issueType-template.xml
index 4aacf92..e2646b2 100644
--- a/src/main/resources/mybatis/query-template/issueType-template.xml
+++ b/src/main/resources/mybatis/query-template/issueType-template.xml
@@ -17,13 +17,30 @@
         <if test="name != '' and name != null">
             AND it.name like CONCAT('%',#{name},'%')
         </if>
+        <choose>
+            <when test="allProjectIds != null and allProjectIds.size != 0">
+                AND it.project_id IN
+                <foreach collection="allProjectIds" item="item" index="index" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </when>
+        </choose>
         <if test="projectId != '' and projectId != null">
             AND it.project_id like CONCAT('%',#{projectId},'%')
         </if>
+        <choose>
+            <when test="downProjectIds != null and downProjectIds.size != 0">
+                OR it.project_id IN
+                <foreach collection="downProjectIds" item="item" index="index" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </when>
+        </choose>
         <if test="useProject != '' and useProject != null and useProject == true">
             AND it.project_id IS NOT NULL
         </if>
         AND ws.id = #{workspaceId}
+        ORDER BY it.id DESC
         <if test="page != null and !page.equals('')">
             limit #{pageSize} offset #{page};
         </if>

--
Gitblit v1.8.0