From bb9ffb8a419e83f1c2b1d6b33b6ed6731098c394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Fri, 27 May 2022 17:40:17 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=AC=EB=AC=B8=EB=B3=B4=EA=B3=A0>=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=EA=B8=B0=EB=8A=A5>=EB=AA=A9=ED=91=9C/=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=EC=A1=B0=ED=9A=8C=20=EB=B6=80=EC=84=9C=EB=B3=84=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sqlmapper/mappers/report/reportGoal.xml | 69 ++++++++++++------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/src/main/resources/sqlmapper/mappers/report/reportGoal.xml b/src/main/resources/sqlmapper/mappers/report/reportGoal.xml index 197f706..40cce58 100644 --- a/src/main/resources/sqlmapper/mappers/report/reportGoal.xml +++ b/src/main/resources/sqlmapper/mappers/report/reportGoal.xml @@ -108,28 +108,49 @@ + select (row_number() over()) AS rn, + t.* + from ( + SELECT p.code2 AS CODE, + p.codenm AS NAME, + coalesce(go_goal1, 0) AS GOAL1, + coalesce(go_goal2, 0) AS GOAL2, + coalesce(go_goal3, 0) AS GOAL3, + coalesce(go_goal4, 0) AS GOAL4, + coalesce(go_total, 0) AS GOAL_TOTAL, + coalesce(ri.result1, 0) AS RESULT1, + coalesce(ri.result2, 0) AS RESULT2, + coalesce(ri.result3, 0) AS RESULT3, + coalesce(ri.result4, 0) AS RESULT4, + coalesce(ri.result_total, 0) AS RESULT_TOTAL + from tcode p + left outer join ( + select go_place1, + sum(go_goal1) as go_goal1, + sum(go_goal2) as go_goal2, + sum(go_goal3) as go_goal3, + sum(go_goal4) as go_goal4, + sum(go_total) as go_total + from RPT_AGENT_GOAL + where go_year = ${year} + and go_month = ${month} + group by go_place1 + ) G ON G.GO_PLACE1 = P.CODE2 + left outer join ( + select in_place_code, + count(1) filter (where in_category4 = '01') as result1, + count(1) filter (where in_category4 = '02') as result2, + count(1) filter (where in_category4 in ('03', '04', '05')) as result3, + count(1) filter (where in_category4 = '06') as result4, + count(1) as result_total + from rpt_info + where in_complete = '1' + and in_info_year = ${year} + and in_info_month = ${month} + group by in_place_code + ) ri on p.code2 = ri.in_place_code + WHERE p.code1 = 'C001' + order by p.code2 + ) t + \ No newline at end of file