From 3bdf2a1f2757de8ab6570508385d89124243943c Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 금, 10 12월 2021 15:34:13 +0900 Subject: [PATCH] 일반회원 대시보드 오류 해결 --- src/main/resources/mybatis/query-template/widget-template.xml | 130 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 118 insertions(+), 12 deletions(-) diff --git a/src/main/resources/mybatis/query-template/widget-template.xml b/src/main/resources/mybatis/query-template/widget-template.xml index 02b923b..4b94ec0 100644 --- a/src/main/resources/mybatis/query-template/widget-template.xml +++ b/src/main/resources/mybatis/query-template/widget-template.xml @@ -29,7 +29,7 @@ SELECT COUNT(i.id) FROM issue i INNER JOIN issue_department isd ON isd.issue_id = i.id - INNER JOIN department d ON d.id = isd.department_id + INNER JOIN user_department ud ON ud.department_id = isd.department_id WHERE EXISTS(SELECT 1 FROM issue_status iss WHERE iss.issue_status_type != 'CLOSE' AND i.issue_status_id = iss.id) <choose> @@ -47,6 +47,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> </select> @@ -73,7 +76,7 @@ SELECT COUNT(i.id) FROM issue i INNER JOIN issue_department isd ON isd.issue_id = i.id - INNER JOIN department d ON d.id = isd.department_id + INNER JOIN user_department ud ON ud.department_id = isd.department_id where exists(select 1 from issue_status iss where iss.id = i.issue_status_id and iss.issue_status_type != 'CLOSE') <choose> <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> @@ -90,6 +93,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> AND i.complete_date IS NOT NULL AND i.complete_date <![CDATA[ < ]]> #{completeDate} @@ -153,7 +159,7 @@ SELECT COUNT(i.id) FROM issue i INNER JOIN issue_department isd ON isd.issue_id = i.id - INNER JOIN department d ON d.id = isd.department_id + INNER JOIN user_department ud ON ud.department_id = isd.department_id WHERE EXISTS(SELECT 1 FROM issue_department isd WHERE isd.issue_id = i.id <choose> <when test="myDepartmentIds.size != 0"> @@ -199,7 +205,7 @@ select count(i.id) as todayCount from issue i INNER JOIN issue_department isd ON isd.issue_id = i.id - INNER JOIN department d ON d.id = isd.department_id + INNER JOIN user_department ud ON ud.department_id = isd.department_id where i.register_id = #{loginUserId} <choose> @@ -217,6 +223,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> AND i.register_date BETWEEN (CURDATE()) AND (CURDATE() + INTERVAL 1 DAY) </select> @@ -259,7 +268,7 @@ AND isd.id IS NULL </select> - <select id="countNoAssigneeIssueByDepartment" resultType="java.lang.Long" + <!--<select id="countNoAssigneeIssueByDepartment" resultType="java.lang.Long" parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> SELECT COUNT(DISTINCT i.id) FROM issue i @@ -283,7 +292,7 @@ </when> </choose> AND isd.id IS NULL - </select> + </select>--> <!-- �셿猷뚮맂 �씠�뒋 媛쒖닔 --> <select id="countCompleteIssue" resultType="java.lang.Long" @@ -308,7 +317,7 @@ count(*) as issueCount from issue i inner join issue_status iss on iss.id = i.issue_status_id INNER JOIN issue_department isd ON isd.issue_id = i.id - INNER JOIN department d ON d.id = isd.department_id + INNER JOIN user_department ud ON ud.department_id = isd.department_id where iss.issue_status_type = 'CLOSE' <choose> <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> @@ -325,6 +334,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> </select> @@ -535,14 +547,19 @@ parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> select count(i.id) as todayCount from issue i where - exists(select 1 from issue_department isd where isd.issue_id = i.id + exists(select 1 from issue_department isd + INNER JOIN user_department ud ON ud.department_id = isd.department_id + where isd.issue_id = i.id <choose> - <when test="myDepartmentIds.size != 0"> + <when test="myDepartmentIds != null and myDepartmentIds.size != 0"> AND isd.department_id IN <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> and isd.register_date BETWEEN (CURDATE()) AND (CURDATE() + INTERVAL 1 DAY)) @@ -601,6 +618,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> And iss.issue_status_type != 'CLOSE' </select> @@ -684,6 +704,7 @@ replace(SUBSTRING(i.register_date, 1, 10), "-", ".") as registerDate from issue i inner join issue_department isd on isd.issue_id = i.id + INNER JOIN user_department ud ON ud.department_id = isd.department_id inner join issue_status iss on iss.id = i.issue_status_id inner join project p on p.id = i.project_id WHERE 1=1 @@ -696,12 +717,15 @@ </when> </choose> <choose> - <when test="myDepartmentIds.size != 0"> + <when test="myDepartmentIds != null and myDepartmentIds.size != 0"> AND isd.department_id IN <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> and iss.issue_status_type != 'CLOSE' GROUP by i.id @@ -1001,6 +1025,46 @@ group by p.id </select> + <select id="findByStandIssueStatusOfDepartment" resultType="java.util.HashMap" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + select + <choose> + <when test="issueStatuses.size != 0"> + <foreach collection="issueStatuses" item="item" index="index" separator="," open="" close=""> + count(case when i.issue_status_id = #{item.id} then 1 end) as #{item.name} + </foreach> + </when> + </choose> + ,p.id, + p.name as projectName + from issue i + inner join project p on p.id = i.project_id + inner join issue_status iss on iss.id = i.issue_status_id + INNER JOIN issue_department isd ON isd.issue_id = i.id + INNER JOIN user_department ud ON ud.department_id = isd.department_id + where 1=1 + <choose> + <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + AND i.project_id IN + <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + <choose> + <when test="myDepartmentIds != null and myDepartmentIds.size != 0"> + AND isd.department_id IN + <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + <otherwise> + AND 1 != 1 + </otherwise> + </choose> + group by p.id + </select> + <!-- 9踰� �쐞�젽 �걹 --> <!-- 11踰� �쐞�젽 �떆�옉 --> @@ -1085,6 +1149,7 @@ from department d inner join project_role_department prd on prd.department_id = d.id + INNER JOIN user_department ud ON ud.department_id = prd.department_id inner join project_role pr on pr.id = prd.project_role_id inner join project p on p.id = pr.project_id WHERE @@ -1103,6 +1168,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> and p.status = '02'; </select> @@ -1180,6 +1248,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> and iss.issue_status_type = 'CLOSE' <choose> @@ -1225,6 +1296,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> <choose> <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> @@ -1243,9 +1317,30 @@ <select id="findByStandIssueType" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> - SELECT issue_type.name as name, COUNT(issue.id) as issueCount FROM issue issue - INNER JOIN issue_type issue_type ON issue.issue_type_id = issue_type.id + SELECT issue_type.name as name, COUNT(issue.id) as issueCount FROM issue + INNER JOIN issue_type ON issue.issue_type_id = issue_type.id WHERE issue.project_id = #{projectId} + GROUP BY issue_type.name + </select> + + <select id="findByStandIssueTypeOfDepartment" resultType="java.util.HashMap" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT issue_type.name as name, COUNT(issue.id) as issueCount FROM issue + INNER JOIN issue_type ON issue.issue_type_id = issue_type.id + INNER JOIN issue_department isd ON isd.issue_id = issue.id + INNER JOIN user_department ud ON ud.department_id = isd.department_id + WHERE issue.project_id = #{projectId} + <choose> + <when test="myDepartmentIds != null and myDepartmentIds.size != 0"> + AND isd.department_id IN + <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + <otherwise> + AND 1 != 1 + </otherwise> + </choose> GROUP BY issue_type.name </select> @@ -1289,6 +1384,7 @@ INNER JOIN severity s ON s.id = i.severity_id INNER JOIN issue_status iss ON iss.id = i.issue_status_id INNER JOIN issue_department isd on isd.issue_id = i.id + INNER JOIN user_department ud ON ud.department_id = isd.department_id WHERE w.id = #{workspaceId} AND iss.issue_status_type != 'CLOSE' <choose> @@ -1306,6 +1402,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> </select> @@ -1363,6 +1462,7 @@ INNER JOIN severity s ON s.id = i.severity_id INNER JOIN issue_status iss ON iss.id = i.issue_status_id INNER JOIN issue_department isd on isd.issue_id = i.id + INNER JOIN user_department ud ON ud.department_id = isd.department_id WHERE w.id = #{workspaceId} AND s.id = #{severityId} AND iss.issue_status_type != 'CLOSE' @@ -1381,6 +1481,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> <if test="page != null and !page.equals('')"> limit #{pageSize} offset #{page}; @@ -1436,6 +1539,9 @@ #{item} </foreach> </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> </select> -- Gitblit v1.8.0