itn 2023-09-06
문자전송순위 성능개선
@d490a7160ef42eae6066a372906aae220ad354ee
src/main/resources/egovframework/sqlmap/let/msg/MjonMsgData_SQL_mysql.xml
--- src/main/resources/egovframework/sqlmap/let/msg/MjonMsgData_SQL_mysql.xml
+++ src/main/resources/egovframework/sqlmap/let/msg/MjonMsgData_SQL_mysql.xml
@@ -2687,91 +2687,66 @@
 	</select>
 	
 	<select id="mjonMsgDAO.selectRankNumberList_230125" parameterClass="mjPhoneMemberVO" resultClass="mjPhoneMemberVO">
-			SELECT 
-				COUNT(A.USER_ID) OVER() AS totCnt,
-				A.USER_ID AS userId, 
-				A.CNT AS msgGroupCnt,
-			    RANK() OVER (ORDER BY CNT DESC) AS rank,
-	
-			    DATE_FORMAT(D.SBSCRB_DE, '%Y-%m-%d %H:%i' )  AS  sbscrbDe,
-			    F.totPrice,
-			    E.USER_MONEY AS userMoney
-			    , DATE_FORMAT(a.frstRegistPnttm, '%H:%i:%s')	AS	frstRegistPnttm
- 
-		    FROM
+		SELECT
+			M.totCnt,
+			M.userId, 
+			M.msgGroupCnt,
+		    M.rank,
+		    M.sbscrbDe,
+		    M.userMoney,
+		    M.frstRegistPnttm,
 			(
-         		 SELECT  AA.MBER_ID AS user_id,
-                          sum(cnt) CNT    
-                          , max(regist_pnttm) as frstRegistPnttm                      
-                 FROM    mj_sttst_msg_rank AA
-                 WHERE 1=1
-						<isNotEmpty property="msgType">
-							AND MSG_TYPE = #msgType#
-						</isNotEmpty>
-						<isNotEmpty property="agentCode">
-							AND AGENT_CODE = #agentCode#
-						</isNotEmpty>						                 
-                 GROUP BY AA.MBER_ID                 					
-			) A 
-			/*
-			LEFT JOIN ( 
-	        	SELECT CODE_NM , CODE , CODE_DC 
-	        	FROM LETTCCMMNDETAILCODE     
-	        	WHERE USE_AT = 'Y'       
-	        	AND CODE_ID = 'ITN022' 
-	     	) B ON A.MSG_TYPE = B.CODE	LEFT JOIN ( 
-        		SELECT CODE_NM , CODE , CODE_DC 
-        		FROM LETTCCMMNDETAILCODE     
-        		WHERE USE_AT = 'Y'       
-        		AND CODE_ID = 'ITN019' 
-	     	) C ON A.AGENT_CODE = C.CODE
-	     	*/
-	     	LEFT JOIN COMVNUSERMASTER D   ON  A.USER_ID = D.USER_ID
-	     	LEFT JOIN LETTNGNRLMBER   E   ON  A.USER_ID = E.MBER_ID
-	     	
-                 LEFT OUTER JOIN (
-                 
-									select USER_ID
-										, sum(totcnt) totPrice	
-										
-									from (
-									        SELECT A.USER_ID,
-									               ifnull(totCnt, '0') AS totCnt,
-									               'CASH'              AS divFlag
-									        FROM   ( 
-															SELECT  USER_ID,
-									                               ABS(SUM(CASH)) AS totCnt
-									                      FROM     MJ_CASH A
-									                      WHERE    1=1
-									                      AND      A.DEL_FLAG             = 'N'
-									                      AND      MSG_GROUP_ID IS NOT NULL
-									                      AND      0	>	A.CASH
-									                      GROUP BY USER_ID
-									               )
-									               A
-									        
-										)aa
-									group by aa.USER_ID	                 
-                 
-                 )F
-                 
-                 ON       A.USER_ID = F.USER_ID	     	
-	     	
-    	WHERE 1=1
-		<isNotEmpty property="ntceBgnde">
-			AND <![CDATA[ DATE_FORMAT(E.SBSCRB_DE, '%Y-%m-%d')  >=   #ntceBgnde# ]]>
-		</isNotEmpty>
-		<isNotEmpty property="ntceEndde">
-			AND <![CDATA[ DATE_FORMAT(E.SBSCRB_DE, '%Y-%m-%d')  <=   #ntceEndde# ]]>
-		</isNotEmpty>    	
-		ORDER BY 1=1
-		<isNotEmpty property="searchSortCnd">
-			,$searchSortCnd$
-		</isNotEmpty>
-		<isNotEmpty property="searchSortOrd">
-		 	$searchSortOrd$
-		</isNotEmpty>
-		LIMIT  #recordCountPerPage# OFFSET #firstIndex#	
+				SELECT ABS(SUM(CASH))
+		        FROM     MJ_CASH C
+		        WHERE    1=1
+		        AND M.userId = C.USER_ID
+		        AND      C.DEL_FLAG             = 'N'
+		        AND      MSG_GROUP_ID IS NOT NULL
+		        AND      0	>	C.CASH
+		        GROUP BY C.USER_ID
+			) totPrice		
+		FROM (
+				SELECT 
+					COUNT(A.USER_ID) OVER() AS totCnt,
+					A.USER_ID AS userId, 
+					A.CNT AS msgGroupCnt,
+				    RANK() OVER (ORDER BY CNT DESC) AS rank,
+				    DATE_FORMAT(D.SBSCRB_DE, '%Y-%m-%d %H:%i' )  AS  sbscrbDe,
+				    E.USER_MONEY AS userMoney
+				    , DATE_FORMAT(a.frstRegistPnttm, '%H:%i:%s')	AS	frstRegistPnttm
+			    FROM
+				(
+	         		 SELECT  AA.MBER_ID AS user_id,
+	                          sum(cnt) CNT    
+	                          , max(regist_pnttm) as frstRegistPnttm                      
+	                 FROM    mj_sttst_msg_rank AA
+	                 WHERE 1=1
+							<isNotEmpty property="msgType">
+								AND MSG_TYPE = #msgType#
+							</isNotEmpty>
+							<isNotEmpty property="agentCode">
+								AND AGENT_CODE = #agentCode#
+							</isNotEmpty>						                 
+	                 GROUP BY AA.MBER_ID                 					
+				) A 
+		     	LEFT JOIN COMVNUSERMASTER D   ON  A.USER_ID = D.USER_ID
+		     	LEFT JOIN LETTNGNRLMBER   E   ON  A.USER_ID = E.MBER_ID
+	    	WHERE 1=1
+			<isNotEmpty property="ntceBgnde">
+				AND <![CDATA[ DATE_FORMAT(E.SBSCRB_DE, '%Y-%m-%d')  >=   #ntceBgnde# ]]>
+			</isNotEmpty>
+			<isNotEmpty property="ntceEndde">
+				AND <![CDATA[ DATE_FORMAT(E.SBSCRB_DE, '%Y-%m-%d')  <=   #ntceEndde# ]]>
+			</isNotEmpty>    	
+			ORDER BY 1=1
+			<isNotEmpty property="searchSortCnd">
+				,$searchSortCnd$
+			</isNotEmpty>
+			<isNotEmpty property="searchSortOrd">
+			 	$searchSortOrd$
+			</isNotEmpty>
+			LIMIT  #recordCountPerPage# OFFSET #firstIndex#	
+		) M
 	</select>
 		
 	<!-- today 전송사별 전송건수 -->
src/main/webapp/WEB-INF/jsp/uss/ion/msg/RankNumberList_230125.jsp
--- src/main/webapp/WEB-INF/jsp/uss/ion/msg/RankNumberList_230125.jsp
+++ src/main/webapp/WEB-INF/jsp/uss/ion/msg/RankNumberList_230125.jsp
@@ -114,6 +114,13 @@
 	
 }
 
+function fnSelectMber(mberId) {
+	document.modiForm2.mberId.value = mberId;
+	window.open("about:blank", 'popupSelectMber', 'width=900, height=1800, top=100, left=100, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=yes, location=no, scrollbar=no');
+    document.modiForm2.action = "<c:url value='/uss/umt/user/EgovGnrlselectedUserView.do'/>";
+    document.modiForm2.target = "popupSelectMber";
+    document.modiForm2.submit();
+}
 </script>
 <style>
 .calBtn {
@@ -203,25 +210,23 @@
 			<div class="tableWrap">
 				<table class="tbType1">
 					<colgroup>
-						<col style="width: 5%">
-						<col style="width: 5%">
+						<col style="width: 7%">
+						<col style="width: *%">
 						<col style="width: 15%">
 						<col style="width: 15%">
-						<col style="width: 15%">
-						<col style="width: 5%">
 						<col style="width: 10%">
+						<col style="width: 15%">
 						<col style="width: 15%">
 						<col style="width: 10%">
 					</colgroup>
 					<thead>
 						<tr>
-							<th>번호<input type="button" class="sort sortBtn" id="sort_rank"></th>
-							<th>순위</th>
+							<th>순위<input type="button" class="sort sortBtn" id="sort_rank"></th>
 							<th>아이디(사용자)<input type="button" class="sort sortBtn" id="sort_userId"></th>
 							<th>가입일시<input type="button" class="sort sortBtn" id="sort_sbscrbDe"></th>
-							<th>보유잔액<input type="button" class="sort sortBtn" id="sort_sbscrbDe"></th>
+							<th>보유잔액<input type="button" class="sort sortBtn" id="sort_userMoney"></th>
 							<th>발송건수<input type="button" class="sort sortBtn" id="sort_msgGroupCnt"></th>
-							<th>발송금액<input type="button" class="sort sortBtn" id="sort_totPrice"></th>
+							<th>발송금액</th>
 							<th>메세지타입</th>
 							<th>전송사</th>
 						</tr>
@@ -229,27 +234,25 @@
 					<tbody>
 						<c:forEach var="result" items="${resultList}" varStatus="status">
 						<tr>
-							<td>
-								<c:if test="${searchVO.searchSortOrd eq 'desc' }">
-		                			<c:out value="${ ( paginationInfo.totalRecordCount - ((paginationInfo.currentPageNo -1)*paginationInfo.recordCountPerPage) ) - status.index }"/>
-			                	</c:if>
-			                	<c:if test="${searchVO.searchSortOrd eq 'asc' }">
-									<c:out value="${(paginationInfo.currentPageNo - 1) * paginationInfo.recordCountPerPage + status.count}"/>                   		
-			                	</c:if>
-							</td>
 							<td><c:out value="${result.rank}"/></td>
 							<td>
-								<a href="#" onclick="fn_send_member_list('${result.userId}'); return false;">
+								<a href="#"  onclick="javascript:fnSelectMber('<c:out value="${result.userId}"/>'); return false;">
 									<c:out value="${result.userId}"/>
 								</a>
 							</td>
-							<td><c:out value="${result.sbscrbDe}"/></td>
+							<td>
+								<a href="#" onclick="fn_send_member_list('${result.userId}'); return false;"><c:out value="${result.sbscrbDe}"/></a>
+							</td>
+							<td>
+								<a href="#" onclick="fn_send_member_list('${result.userId}'); return false;">${result.userMoney}</a>
+							</td>
 							
-							<td>${result.userMoney}</td>
-							
-							<td><c:out value="${result.msgGroupCnt}"/></td>
-							<td><c:out value="${result.totPrice}"/></td>
-							
+							<td>
+								<a href="#" onclick="fn_send_member_list('${result.userId}'); return false;"><c:out value="${result.msgGroupCnt}"/></a>
+							</td>
+							<td>
+								<a href="#" onclick="fn_send_member_list('${result.userId}'); return false;"><c:out value="${result.totPrice}"/></a>
+							</td>
 							<td>
 								<c:if test="${empty searchVO.msgType}">
 									메시지타입(전체)
@@ -291,5 +294,10 @@
 <form name="modiForm" method="get" action="<c:url value='/uss/ion/msg/SendMsgList.do'/>" >
 	<input name="userId" type="hidden" />
 </form>
+
+<form name="modiForm2" id="modiForm2" method="post">
+	<input name="mberId" type="hidden" />
+</form>
+
 </body>
 </html>
Add a comment
List