wyh 2023-12-07
사용내역서, 거래명세서 팝업 거래 금액 조회 쿼리 수정
@95b7785445950893023a57ebc8b83328402272d4
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
@@ -3307,9 +3307,9 @@
 			, M.msgTypeName
 			, M.orderByCode
 			, SUM(M.MSG_GROUP_CNT) AS sendCount
-			, SUM(M.supplyPrice) AS supplyPrice
+			, ifnull(ROUND(SUM(M.EACH_PRICE) , 2), 0) AS supplyPrice
 			, 0 AS vatPrice
-			, SUM(M.supplyPrice) AS totalPrice 
+			, ifnull(ROUND(SUM(M.EACH_PRICE) , 2), 0) AS totalPrice
 		FROM (
 			SELECT 
 				B.REGDATE
@@ -3335,22 +3335,19 @@
 					THEN '2'
 					ELSE '1'
 				END orderByCode
+				, (<include refid="MjonMsgSentDAO.selectAgentResultQuery_A"/>)
+				AS RESULT
 			FROM 
-				MJ_MSG_GROUP_DATA B
-			WHERE
-				B.USER_ID = #userId#
-				AND B.DEL_FLAG = 'N'
-				AND B.MSG_GROUP_ID IN 
-				(
-					SELECT 
-						A.MSG_GROUP_ID
-					FROM
-						MJ_MSG_DATA A
-					WHERE
-						IFNULL(A.DEL_FLAG,'N') = 'N'
-						AND A.RESERVE_C_YN = 'N'
-						AND (<include refid="MjonMsgSentDAO.selectAgentResultQuery_A"/>) IN ('W','S')
-				)
+				MJ_MSG_DATA A
+				, MJ_MSG_GROUP_DATA B
+			WHERE 1=1
+				AND A.MSG_GROUP_ID = B.MSG_GROUP_ID
+				AND A.USER_ID				= #userId#
+				AND B.USER_ID				= #userId#
+				AND B.DEL_FLAG				= 'N'
+				AND IFNULL(B.DEL_FLAG,'N')	= 'N'
+				AND B.RESERVE_C_YN			= 'N'
+				
 			<isNotEmpty property="startDate">
 				AND <![CDATA[ B.REQ_DATE  >=   #startDate# ]]>
 			</isNotEmpty>
@@ -3378,6 +3375,8 @@
 				</isEqual>
 			</isNotEmpty>
 		) M
+		WHERE 1=1
+		AND M.RESULT IN ('W','S')
 		GROUP BY M.msgTypeName
 		ORDER BY M.orderByCode	
 	</select>
Add a comment
List