From 2f487b0dfb289fd1971f126eda1e3d7778f026ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Wed, 25 May 2022 17:47:06 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=AC=EB=AC=B8=20=EC=88=98=EC=A0=95,=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=AC=B4?= =?UTF-8?q?=EA=B0=80=EC=B9=98=20=ED=8C=90=EC=A0=95=EA=B8=B0=EC=A4=80=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9.=20=EA=B2=AC=EB=AC=B8=EB=B3=B4=EA=B3=A0=20>?= =?UTF-8?q?=20=EA=B4=80=EB=A6=AC=EA=B8=B0=EB=8A=A5=20=ED=95=98=EC=9C=84=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=20=EC=BF=BC=EB=A6=AC=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sqlmapper/mappers/report/report.xml | 31 ++----- .../sqlmapper/mappers/report/reportGoal.xml | 93 +++++++++++-------- .../webapp/WEB-INF/jsp/report/goalStats.jsp | 38 ++++---- .../webapp/WEB-INF/jsp/report/presentList.jsp | 13 ++- .../WEB-INF/jsp/report/reportModify.jsp | 56 +++-------- 5 files changed, 104 insertions(+), 127 deletions(-) diff --git a/src/main/resources/sqlmapper/mappers/report/report.xml b/src/main/resources/sqlmapper/mappers/report/report.xml index 950b35e..4f6f56c 100644 --- a/src/main/resources/sqlmapper/mappers/report/report.xml +++ b/src/main/resources/sqlmapper/mappers/report/report.xml @@ -1230,19 +1230,14 @@ - SELECT - T.*, ROWNUM AS RN - FROM - ( - SELECT - A.NAME, - A.USERID AS go_id, - COALESCE(G.GO_GOAL1, 0) AS goGoal1, - COALESCE(G.GO_GOAL2, 0) AS goGoal2, - COALESCE(G.GO_GOAL3, 0) AS goGoal3, - COALESCE(G.GO_GOAL4, 0) AS goGoal4, - COALESCE(G.GO_TOTAL, 0) AS goTotal - FROM - (SELECT * FROM TAGENT WHERE PLACE1 = #{placeGroup}) A - LEFT OUTER JOIN - (SELECT DISTINCT * FROM RPT_AGENT_GOAL WHERE GO_MONTH = #{month} AND GO_YEAR = #{year}) G - ON G.GO_ID = A.USERID - ORDER BY - POSITION DESC, PLACE2, PLACE3, DUTIES, NAME - ) T + select (row_number () over()) AS rn, + t.* + from ( + select + a.name, + a.userid as go_id, + coalesce(b.go_goal1, 0) AS goGoal1, + coalesce(b.go_goal2, 0) AS goGoal2, + coalesce(b.go_goal3, 0) AS goGoal3, + coalesce(b.go_goal4, 0) AS goGoal4, + coalesce(b.go_total, 0) AS goTotal + from tagent a + left outer join rpt_agent_goal b on a.userid = b.go_id + and a.place1 = #{placeGroup} + and b.go_month = ${month} + and b.go_year = ${year} + order by position desc, place2, place3, duties, name + ) t - SELECT - ROWNUM AS RN, T.* - FROM - ( - SELECT - 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_GOAL1, 0) + COALESCE(GO_GOAL2, 0) + COALESCE(GO_GOAL3, 0) + COALESCE(GO_GOAL4, 0) AS GOAL_TOTAL, - (SELECT COUNT(*) FROM RPT_INFO WHERE IN_COMPLETE = 1 AND IN_USERID = A.USERID AND IN_INFO_YEAR = G.GO_YEAR AND IN_INFO_MONTH = G.GO_MONTH AND IN_CATEGORY4 = '01') AS RESULT1, - (SELECT COUNT(*) FROM RPT_INFO WHERE IN_COMPLETE = 1 AND IN_USERID = A.USERID AND IN_INFO_YEAR = G.GO_YEAR AND IN_INFO_MONTH = G.GO_MONTH AND IN_CATEGORY4 = '02') AS RESULT2, - (SELECT COUNT(*) FROM RPT_INFO WHERE IN_COMPLETE = 1 AND IN_USERID = A.USERID AND IN_INFO_YEAR = G.GO_YEAR AND IN_INFO_MONTH = G.GO_MONTH AND IN_CATEGORY4 IN ('03', '04', '05')) AS RESULT3, - (SELECT COUNT(*) FROM RPT_INFO WHERE IN_COMPLETE = 1 AND IN_USERID = A.USERID AND IN_INFO_YEAR = G.GO_YEAR AND IN_INFO_MONTH = G.GO_MONTH AND IN_CATEGORY4 = '06') AS RESULT4, - (SELECT COUNT(*) FROM RPT_INFO WHERE IN_COMPLETE = 1 AND IN_USERID = A.USERID AND IN_INFO_YEAR = G.GO_YEAR AND IN_INFO_MONTH = G.GO_MONTH) AS RESULT_TOTAL - FROM - (SELECT * FROM TAGENT WHERE PLACE1 = #{placeGroup}) A - LEFT OUTER JOIN - (SELECT DISTINCT * FROM RPT_AGENT_GOAL WHERE GO_YEAR = #{year} AND GO_MONTH = #{month}) G - ON G.GO_ID = A.USERID - ORDER BY - POSITION DESC, PLACE2, PLACE3, DUTIES, NAME - ) T + select (row_number () over()) AS rn, + t.* + from ( + select a.name, + a.userid as go_id, + coalesce(b.go_goal1, 0) AS goal1, + coalesce(b.go_goal2, 0) AS goal2, + coalesce(b.go_goal3, 0) AS goal3, + coalesce(b.go_goal4, 0) AS goal4, + coalesce(b.go_total, 0) AS goal_total, + coalesce(c.result1, 0) as result1, + coalesce(c.result2, 0) as result2, + coalesce(c.result3, 0) as result3, + coalesce(c.result4, 0) as result4, + coalesce(c.result_total, 0) as result_total + from tagent a + left outer join rpt_agent_goal b + on a.place1 = #{placeGroup} and b.go_year = ${year} and b.go_month = ${month} and a.userid = b.go_id + left outer join ( + select in_userid, + 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_place_code = #{placeGroup} + and in_info_year = ${year} + and in_info_month = ${month} + group by in_userid + ) c on c.in_userid = a.userid + order by position desc, place2, place3, duties, name + ) t