From 689e17c797bf3844f7b6b6f7c086df9bd8f72a0c Mon Sep 17 00:00:00 2001 From: wyu <kknd09321@nate.com> Date: 화, 28 12월 2021 19:45:34 +0900 Subject: [PATCH] Merge branch 'master' of http://192.168.0.25:9001/r/owl-kisa --- src/main/resources/mybatis/query-template/widget-template.xml | 647 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 556 insertions(+), 91 deletions(-) diff --git a/src/main/resources/mybatis/query-template/widget-template.xml b/src/main/resources/mybatis/query-template/widget-template.xml index b482c87..1f57277 100644 --- a/src/main/resources/mybatis/query-template/widget-template.xml +++ b/src/main/resources/mybatis/query-template/widget-template.xml @@ -15,12 +15,41 @@ WHERE EXISTS(SELECT 1 FROM issue_status iss WHERE iss.issue_status_type != 'CLOSE' AND i.issue_status_id = iss.id) <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + </select> + + <select id="countRemainIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT + COUNT(i.id) 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 + WHERE EXISTS(SELECT 1 FROM issue_status iss WHERE iss.issue_status_type != 'CLOSE' AND i.issue_status_id = + iss.id) + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" 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> </select> @@ -31,12 +60,42 @@ COUNT(i.id) FROM issue i 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"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + AND i.complete_date IS NOT NULL + AND i.complete_date <![CDATA[ < ]]> #{completeDate} + </select> + + <select id="countTodayDelayIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT + COUNT(i.id) 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 + where exists(select 1 from issue_status iss where iss.id = i.issue_status_id and iss.issue_status_type != 'CLOSE') + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" 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> AND i.complete_date IS NOT NULL AND i.complete_date <![CDATA[ < ]]> #{completeDate} @@ -72,10 +131,10 @@ parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> SELECT COUNT(i.id) FROM issue i - WHERE EXISTS(SELECT 1 FROM issue_department id WHERE id.issue_id = i.id + WHERE EXISTS(SELECT 1 FROM issue_department isd WHERE isd.issue_id = i.id <choose> <when test="myDepartmentIds.size != 0"> - AND id.department_id IN + AND isd.department_id IN <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> @@ -86,9 +145,38 @@ </choose> ) AND 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"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + </select> + + <select id="countAssigneeIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT + COUNT(i.id) 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 + WHERE EXISTS(SELECT 1 FROM issue_department isd WHERE isd.issue_id = i.id + <choose> + <when test="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 EXISTS(SELECT 1 FROM issue_status iss WHERE iss.id = i.issue_status_id and iss.issue_status_type != 'CLOSE') + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -102,12 +190,42 @@ count(i.id) as todayCount from issue i where i.register_id = #{loginUserId} <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + AND i.register_date BETWEEN (CURDATE()) AND (CURDATE() + INTERVAL 1 DAY) + </select> + + <select id="countTodayRegisterIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + select + count(i.id) as todayCount 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 + where + i.register_id = #{loginUserId} + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" 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> AND i.register_date BETWEEN (CURDATE()) AND (CURDATE() + INTERVAL 1 DAY) </select> @@ -121,9 +239,9 @@ 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.size != 0"> + <when test="projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -136,19 +254,45 @@ parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> SELECT COUNT(DISTINCT i.id) FROM issue i - LEFT OUTER JOIN issue_department id ON id.issue_id = i.id + LEFT OUTER JOIN issue_department isd ON isd.issue_id = i.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"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> </choose> - AND id.id IS NULL + AND isd.id IS NULL </select> + + <!--<select id="countNoAssigneeIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT + COUNT(DISTINCT i.id) FROM issue i + LEFT OUTER JOIN issue_department isd ON isd.issue_id = i.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="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" 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> + </choose> + AND isd.id IS NULL + </select>--> <!-- �셿猷뚮맂 �씠�뒋 媛쒖닔 --> <select id="countCompleteIssue" resultType="java.lang.Long" @@ -158,12 +302,41 @@ inner join issue_status iss on iss.id = i.issue_status_id where iss.issue_status_type = 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + </select> + + <select id="countCompleteIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + select + 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 user_department ud ON ud.department_id = isd.department_id + where iss.issue_status_type = 'CLOSE' + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" 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> </select> @@ -180,9 +353,9 @@ where iss.issue_status_type = 'CLOSE' and i.modify_date between #{searchStartDate} and #{searchEndDate} <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -197,9 +370,9 @@ inner join issue_status iss on iss.id = i.issue_status_id where 1=1 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -277,9 +450,9 @@ left outer join issue_status iss on iss.id = i.issue_status_id WHERE 1=1 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND p.id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -328,9 +501,9 @@ count(case when iss.issue_status_type = 'CLOSE' THEN 1 END) as 'close', count(case when iss.issue_status_type != 'CLOSE' THEN 1 END) as 'remain', (select concat(u.name, "%", u.account, "%", u.profile) from user u - inner join project_role_user pru on pru.user_id = u.id - inner join project_role pr on pr.id = pru.project_role_id - where pr.project_id = p.id and pr.role_type = '02' + inner join project_role_user pru on pru.user_id = u.id + inner join project_role pr on pr.id = pru.project_role_id + where pr.project_id = p.id and pr.role_type = '02' ) as managerInfo , ( @@ -374,10 +547,12 @@ parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> select count(i.id) as todayCount from issue i where - exists(select 1 from issue_department id where id.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"> - AND id.department_id IN + <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> @@ -386,12 +561,12 @@ AND 1 != 1 </otherwise> </choose> - and id.register_date + and isd.register_date BETWEEN (CURDATE()) AND (CURDATE() + INTERVAL 1 DAY)) <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -425,20 +600,20 @@ select count(distinct i.id) from issue i - inner join issue_department id on id.issue_id = i.id + inner join issue_department isd on isd.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id WHERE 1=1 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> </choose> <choose> <when test="myDepartmentIds.size != 0"> - AND id.department_id IN + AND isd.department_id IN <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> @@ -483,8 +658,8 @@ </if> </select>--> - <!-- �궡媛� �떞�떦�븯�뒗 �씠�뒋 - �떞�떦遺��꽌 --> - <select id="findMyAssigneeIssue" resultType="java.util.HashMap" + <!-- �궡媛� �떞�떦�븯�뒗 �씠�뒋 - �떞�떦遺��꽌 --> + <!--<select id="findMyAssigneeIssue" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> select distinct i.id as id, @@ -497,21 +672,54 @@ replace(i.complete_date, "-", ".") as completeDate, replace(SUBSTRING(i.register_date, 1, 10), "-", ".") as registerDate from issue i - inner join issue_department id on id.issue_id = i.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 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND p.id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + and iss.issue_status_type != 'CLOSE' + GROUP by i.id + <if test="page != null and !page.equals('')"> + limit #{pageSize} offset #{page}; + </if> + </select>--> + + <select id="findMyAssigneeIssue" resultType="java.util.HashMap" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + select + distinct i.id as id, + i.title as title, + i.issue_type_id as issueTypeId, + p.name as projectName, + CONCAT(p.project_key, '-', i.issue_number) AS issueKey, + p.project_key as projectKey, + i.issue_number as issueNumber, + iss.name as issueStatusName, + replace(i.complete_date, "-", ".") as completeDate, + 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 + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND p.id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> </choose> <choose> - <when test="myDepartmentIds.size != 0"> - AND id.department_id IN + <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> @@ -562,9 +770,9 @@ inner join issue_status iss on iss.id = i.issue_status_id where iss.issue_status_type != 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -608,16 +816,17 @@ CONCAT(p.project_key, '-', i.issue_number) AS issueKey, i.issue_number as issueNumber, p.project_key as projectKey, - p.name as projectName + p.name as projectName, + i.issue_type_id as issueTypeId from issue i inner join issue_risk ir on ir.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id inner join project p on p.id = i.project_id where iss.issue_status_type != 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND p.id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -638,9 +847,9 @@ inner join issue_status iss on iss.id = i.issue_status_id where iss.issue_status_type != 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -667,6 +876,7 @@ , i.issue_number as issueNumber , p.project_key as projectKey , CONCAT(p.project_key, '-', i.issue_number) AS issueKey + , i.issue_type_id as issueTypeId </if> FROM issue i <if test="page != null and !page.equals('')"> @@ -676,9 +886,9 @@ WHERE 1=1 AND i.register_id = #{loginUserId} <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -707,9 +917,9 @@ AND EXISTS (SELECT 1 FROM issue_status iss WHERE iss.id = i.issue_status_id AND iss.issue_status_type != 'CLOSE') </if> <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -736,18 +946,28 @@ , iss.name as issueStatusName , i.issue_number as issueNumber , p.project_key as projectKey + , i.issue_type_id as issueTypeId , CONCAT(p.project_key, '-', i.issue_number) AS issueKey </if> FROM issue i <if test="page != null and !page.equals('')"> INNER JOIN issue_status iss ON iss.id = i.issue_status_id INNER JOIN project p ON p.id = i.project_id + LEFT OUTER join issue_department isd on isd.issue_id = i.id </if> WHERE 1=1 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" 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> @@ -766,14 +986,23 @@ SELECT COUNT(DISTINCT i.id) FROM issue i INNER JOIN project p ON p.id = i.project_id + LEFT OUTER join issue_department isd on isd.issue_id = i.id <if test="page != null and !page.equals('')"> INNER JOIN issue_status iss ON iss.id = i.issue_status_id </if> WHERE 1=1 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" 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> @@ -802,18 +1031,60 @@ </when> </choose> ,p.id, - p.name as projectName + p.name as projectName, + i.issue_type_id as issueTypeId 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 where 1=1 <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + 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, + i.issue_type_id as issueTypeId + 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="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" 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> @@ -854,17 +1125,17 @@ d.department_name as departmentName, p.name as projectName, (select count(*) from issue i - inner join issue_department id on id.issue_id = i.id + inner join issue_department isd on isd.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id - where id.department_id = d.id and i.project_id = p.id and iss.issue_status_type = 'CLOSE') as completeCount, + where isd.department_id = d.id and i.project_id = p.id and iss.issue_status_type = 'CLOSE') as completeCount, (select count(*) from issue i - inner join issue_department id on id.issue_id = i.id + inner join issue_department isd on isd.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id - where id.department_id = d.id and i.project_id = p.id and iss.issue_status_type != 'CLOSE') as remainCount, + where isd.department_id = d.id and i.project_id = p.id and iss.issue_status_type != 'CLOSE') as remainCount, (select count(*) from issue i - inner join issue_department id on id.issue_id = i.id + inner join issue_department isd on isd.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id - where id.department_id = d.id and i.project_id = p.id and iss.issue_status_type != 'CLOSE' and i.complete_date is not null and i.complete_date <![CDATA[ < ]]> now()) as delayCount + where isd.department_id = d.id and i.project_id = p.id and iss.issue_status_type != 'CLOSE' and i.complete_date is not null and i.complete_date <![CDATA[ < ]]> now()) as delayCount from department d inner join project_role_department prd on prd.department_id = d.id @@ -872,12 +1143,58 @@ inner join project p on p.id = pr.project_id WHERE <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> p.id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + and p.status = '02'; + </select> + + <select id="findProjectMemberIssueByDepartment" resultType="java.util.HashMap" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + select + d.department_name as departmentName, + p.name as projectName, + (select count(*) from issue i + inner join issue_department isd on isd.issue_id = i.id + inner join issue_status iss on iss.id = i.issue_status_id + where isd.department_id = d.id and i.project_id = p.id and iss.issue_status_type = 'CLOSE') as completeCount, + (select count(*) from issue i + inner join issue_department isd on isd.issue_id = i.id + inner join issue_status iss on iss.id = i.issue_status_id + where isd.department_id = d.id and i.project_id = p.id and iss.issue_status_type != 'CLOSE') as remainCount, + (select count(*) from issue i + inner join issue_department isd on isd.issue_id = i.id + inner join issue_status iss on iss.id = i.issue_status_id + where isd.department_id = d.id and i.project_id = p.id and iss.issue_status_type != 'CLOSE' and i.complete_date is not null and i.complete_date <![CDATA[ < ]]> now()) as delayCount + 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 + <choose> + <when test="projectIds != null and projectIds.size != 0"> + p.id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + <choose> + <when test="myDepartmentIds.size != 0"> + AND prd.department_id IN + <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + <otherwise> + AND 1 != 1 + </otherwise> </choose> and p.status = '02'; </select> @@ -896,9 +1213,9 @@ 'CLOSE') AND i.register_id = #{loginUserId} <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -914,9 +1231,9 @@ 'CLOSE') AND i.register_id = #{loginUserId} <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -946,11 +1263,11 @@ <select id="findMyAssigneeCompleteIssue" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> select i.project_id as projectId, count(distinct i.id) as issueCount from issue i - inner join issue_department id on id.issue_id = i.id + inner join issue_department isd on isd.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id <choose> <when test="myDepartmentIds.size != 0"> - AND id.department_id IN + AND isd.department_id IN <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> @@ -961,9 +1278,9 @@ </choose> and iss.issue_status_type = 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -993,12 +1310,12 @@ <select id="findMyAssigneeRemainIssue" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> select i.project_id as projectId, count(distinct i.id) as issueCount from issue i - inner join issue_department id on id.issue_id = i.id + inner join issue_department isd on isd.issue_id = i.id inner join issue_status iss on iss.id = i.issue_status_id where iss.issue_status_type != 'CLOSE' <choose> <when test="myDepartmentIds.size != 0"> - id.department_id IN + AND isd.department_id IN <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> @@ -1008,9 +1325,9 @@ </otherwise> </choose> <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> @@ -1024,9 +1341,38 @@ <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 1=1 + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND issue.project_id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + 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> @@ -1048,12 +1394,49 @@ WHERE w.id = #{workspaceId} AND iss.issue_status_type != 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + </select> + + <select id="countSeverityIssueByDepartment" resultType="java.util.HashMap" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT + COUNT(case when s.id = 1 then 'CRITICAL' END) AS 'critical', + COUNT(case when s.id = 2 then 'MAJOR' END) AS 'major', + COUNT(case when s.id = 3 then 'MINOR' END) AS 'minor', + COUNT(case when s.id = 4 then 'TRIVIAL' END) AS 'trivial' + FROM issue i + INNER JOIN project p ON p.id = i.project_id + INNER JOIN workspace w ON w.id = p.workspace_id + 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> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + <choose> + <when test="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> </select> @@ -1070,7 +1453,8 @@ p.project_key AS projectKey, p.name AS projectName, iss.name AS issueStatusName, - CONCAT(p.project_key, '-', i.issue_number) AS issueKey + CONCAT(p.project_key, '-', i.issue_number) AS issueKey, + i.issue_type_id as issueTypeId FROM issue i INNER JOIN project p ON p.id = i.project_id INNER JOIN workspace w ON w.id = p.workspace_id @@ -1080,12 +1464,60 @@ AND s.id = #{severityId} AND iss.issue_status_type != 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> + </choose> + <if test="page != null and !page.equals('')"> + limit #{pageSize} offset #{page}; + </if> + </select> + + <select id="findSeverityIssuesByDepartment" resultType="java.util.HashMap" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT i.title AS title, + s.name AS severityName, + p.name AS projectName, + s.color AS severityColor, + replace(i.start_date, "-", ".") AS startDate, + replace(i.complete_date, "-", ".") AS completeDate, + i.issue_number AS issueNumber, + p.project_key AS projectKey, + p.name AS projectName, + iss.name AS issueStatusName, + CONCAT(p.project_key, '-', i.issue_number) AS issueKey, + i.issue_type_id as issueTypeId + FROM issue i + INNER JOIN project p ON p.id = i.project_id + INNER JOIN workspace w ON w.id = p.workspace_id + 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' + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + <choose> + <when test="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> <if test="page != null and !page.equals('')"> limit #{pageSize} offset #{page}; @@ -1105,15 +1537,48 @@ AND s.id = #{severityId} AND iss.issue_status_type != 'CLOSE' <choose> - <when test="meAndDownProjectIds != null and meAndDownProjectIds.size != 0"> + <when test="projectIds != null and projectIds.size != 0"> AND i.project_id IN - <foreach collection="meAndDownProjectIds" item="item" index="index" separator="," open="(" close=")"> + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </when> </choose> </select> + <select id="countSearchIssueByDepartment" resultType="java.lang.Long" + parameterType="kr.wisestone.owl.web.condition.WidgetCondition"> + SELECT COUNT(distinct i.id) + FROM issue i + INNER JOIN project p ON p.id = i.project_id + INNER JOIN workspace w ON w.id = p.workspace_id + 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 + WHERE w.id = #{workspaceId} + AND s.id = #{severityId} + AND iss.issue_status_type != 'CLOSE' + <choose> + <when test="projectIds != null and projectIds.size != 0"> + AND i.project_id IN + <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")"> + #{item} + </foreach> + </when> + </choose> + <choose> + <when test="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> + </select> + <!-- 13踰� �쐞�젽 �걹 --> </mapper> -- Gitblit v1.8.0