Selaa lähdekoodia

통계 쿼리 튜닝

skyhopes 4 vuotta sitten
vanhempi
commit
f1f40ebad7

+ 140 - 128
src/main/java/com/style24/persistence/mybatis/shop/TsaStatistics.xml

@@ -420,6 +420,45 @@
 	<!-- 제휴몰 주문 목록 조회 -->
 	<select id="getExtmallOrderList" parameterType="Statistics" resultType="Statistics">
 		/* TsaStatistics.getExtmallOrderList */
+		WITH YOY AS (
+			SELECT X.EXTMALL_ID
+			     , SUM(X.EXTMALL_AMT - X.CNCL_AMT - X.RTN_AMT) AS YOY_TOT_ORD_AMT
+               FROM   TB_STAT_ORD_DAY X
+               WHERE  1 = 1
+				 <![CDATA[
+			     AND X.DAY >= DATE_ADD(STR_TO_DATE(#{startDt},'%Y-%m-%d'), INTERVAL -1 YEAR)
+			     AND X.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL -1 YEAR)
+				 ]]>
+				<if test="multiBrandCd != null">
+					/* 브랜드 */
+					<foreach collection="multiBrandCd" item="item" index="index"  open="AND X.BRAND_CD IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+				<if test="multiFormalGb != null">
+					/* 정상/이월구분 */
+					<foreach collection="multiFormalGb" item="item" index="index"  open="AND X.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+				<if test="multiSupplyCompCd != null">
+					/* 공급처 */
+					<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND X.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+				<if test="multiAfLinkCd != null">
+					/* 채널 */
+					<foreach collection="multiAfLinkCd" item="item" index="index"  open="AND X.AF_LINK_CD IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+				<if test="multiItemkindCd != null">
+					/* 품목 */
+					<foreach collection="multiItemkindCd" item="item" index="index"  open="AND X.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+				<if test="multiFrontGb != null">
+					/* 디바이스 */
+					<foreach collection="multiFrontGb" item="item" index="index"  open="AND X.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+				<if test="multiDistributionGb != null">
+					/* 물류구분 */
+					<foreach collection="multiDistributionGb" item="item" index="index"  open="AND X.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
+				</if>
+			GROUP BY X.EXTMALL_ID
+		)
 		SELECT EXTMALL_NM
 		     , TOT_AMT
 		     , SELL_QTY
@@ -430,56 +469,23 @@
 		     , SELL_FEE_RATE
 		     , EX_USAC_AMT
 		     , YOY_TOT_ORD_AMT
-		     , ROUND(IF(TOT_AMT = 0, 1, TOT_AMT) / IF(YOY_TOT_ORD_AMT = 0, 1, YOY_TOT_ORD_AMT) * 100 - 100,1) AS YOY_RATE
+		     , CASE WHEN TOT_AMT > 0 AND YOY_TOT_ORD_AMT > 0 THEN ROUND(TOT_AMT / YOY_TOT_ORD_AMT * 100 - 100,1)
+		            ELSE 0
+		             END AS YOY_RATE
 		  FROM (
 				SELECT
 				    (SELECT EXTMALL_NM FROM TB_EXTMALL X WHERE X.EXTMALL_ID = A.EXTMALL_ID LIMIT 1) AS EXTMALL_NM
 				    , SUM(A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) AS TOT_AMT /* 총매출 */
-				    , SUM(A.SELL_QTY) AS SELL_QTY /* 판매수량 */
+				    , SUM(A.SELL_QTY) AS SELL_QTY             /* 판매수량 */
 				    , SUM(A.EXTMALL_AMT) AS EXTMALL_AMT
-				    , SUM(A.CNCL_QTY + A.RTN_QTY) AS CNCL_QTY -- 취/반품수량
-				    , SUM(A.CNCL_AMT + A.RTN_AMT) AS CNCL_AMT -- 취/반품액
-				    , SUM(A.REAL_ORD_AMT) AS REAL_ORD_AMT /* 실결제액 */
-				    , (SELECT SELL_FEE_RATE FROM TB_EXTMALL X WHERE X.EXTMALL_ID = A.EXTMALL_ID LIMIT 1) AS SELL_FEE_RATE -- 수수료율
+				    , SUM(A.CNCL_QTY + A.RTN_QTY) AS CNCL_QTY /*취/반품수량*/
+				    , SUM(A.CNCL_AMT + A.RTN_AMT) AS CNCL_AMT /*취/반품액*/
+				    , SUM(A.REAL_ORD_AMT) AS REAL_ORD_AMT     /*실결제액 */
+				    , (SELECT SELL_FEE_RATE FROM TB_EXTMALL X WHERE X.EXTMALL_ID = A.EXTMALL_ID LIMIT 1) AS SELL_FEE_RATE /*수수료율*/
 				    , (SUM(A.REAL_ORD_AMT) * (1 - (SELECT SELL_FEE_RATE FROM TB_EXTMALL X WHERE X.EXTMALL_ID = A.EXTMALL_ID LIMIT 1) / 100)) AS EX_USAC_AMT
-					, IFNULL((SELECT SUM(X.EXTMALL_AMT - X.CNCL_AMT - X.RTN_AMT)
-				               FROM   TB_STAT_ORD_DAY X
-				               WHERE  1 = 1
-				                 AND X.EXTMALL_ID = A.EXTMALL_ID
-							<![CDATA[
-							    AND X.DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
-							    AND X.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)
-							]]>
-								<if test="multiBrandCd != null">
-									/* 브랜드 */
-									<foreach collection="multiBrandCd" item="item" index="index"  open="AND X.BRAND_CD IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-								<if test="multiFormalGb != null">
-									/* 정상/이월구분 */
-									<foreach collection="multiFormalGb" item="item" index="index"  open="AND X.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-								<if test="multiSupplyCompCd != null">
-									/* 공급처 */
-									<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND X.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-								<if test="multiAfLinkCd != null">
-									/* 채널 */
-									<foreach collection="multiAfLinkCd" item="item" index="index"  open="AND X.AF_LINK_CD IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-								<if test="multiItemkindCd != null">
-									/* 품목 */
-									<foreach collection="multiItemkindCd" item="item" index="index"  open="AND X.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-								<if test="multiFrontGb != null">
-									/* 디바이스 */
-									<foreach collection="multiFrontGb" item="item" index="index"  open="AND X.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-								<if test="multiDistributionGb != null">
-									/* 물류구분 */
-									<foreach collection="multiDistributionGb" item="item" index="index"  open="AND X.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
-								</if>
-				              ),0)                                           AS YOY_TOT_ORD_AMT /*전년동기대비매출액*/
+				    , SUM(IFNULL(B.YOY_TOT_ORD_AMT,0)) AS YOY_TOT_ORD_AMT
 				FROM TB_STAT_ORD_DAY A
+				LEFT OUTER JOIN YOY AS B ON A.EXTMALL_ID = B.EXTMALL_ID
 				WHERE 1=1
 				    AND A.EXTMALL_ID IS NOT NULL
 				<![CDATA[
@@ -522,6 +528,37 @@
 	<!-- 채널 주문목록 조회 -->
 	<select id="getChannelOrderList" parameterType="Statistics" resultType="Statistics">
 		/* TsaStatistics.getChannelOrderList */
+		WITH YOY AS (
+		  SELECT X.AF_LINK_CD
+		       , SUM(X.CHANNEL_AMT - X.CNCL_AMT - X.RTN_AMT) AS YOY_TOT_ORD_AMT
+		    FROM TB_STAT_ORD_DAY X
+		   WHERE 1=1
+			<![CDATA[
+			     AND X.DAY >= DATE_ADD(STR_TO_DATE(#{startDt},'%Y-%m-%d'), INTERVAL -1 YEAR)
+			     AND X.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL -1 YEAR)
+			]]>
+			<if test="multiFrontGb != null">
+				/* 디바이스 */
+				<foreach collection="multiFrontGb" item="item" index="index"  open="AND X.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiFormalGb != null">
+				/* 정상/이월구분 */
+				<foreach collection="multiFormalGb" item="item" index="index"  open="AND X.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiDistributionGb != null">
+				/* 물류구분 */
+				<foreach collection="multiDistributionGb" item="item" index="index"  open="AND X.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiSupplyCompCd != null">
+				/* 공급처 */
+				<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND X.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiItemkindCd != null">
+				/* 품목 */
+				<foreach collection="multiItemkindCd" item="item" index="index"  open="AND X.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+		  GROUP BY X.AF_LINK_CD
+		)
 		SELECT AF_LINK_CD
 		     , AF_LINK_NM
 		     , CHANNEL_AMT
@@ -533,11 +570,13 @@
 		     , SELL_FEE_RATE
 		     , EX_USAC_AMT
 		     , YOY_TOT_ORD_AMT
-		     , ROUND(IF(TOT_AMT = 0, 1, TOT_AMT) / IF(YOY_TOT_ORD_AMT = 0, 1, YOY_TOT_ORD_AMT) * 100 - 100,1) AS YOY_RATE
+		     , CASE WHEN TOT_AMT > 0 AND YOY_TOT_ORD_AMT > 0 THEN ROUND(TOT_AMT / YOY_TOT_ORD_AMT * 100 - 100,1)
+		            ELSE 0
+		             END AS YOY_RATE
 		  FROM (
 				SELECT
-				    AF_LINK_CD
-				    , (SELECT AF_LINK_NM FROM TB_AF_LINK X WHERE X.AF_LINK_CD = A.AF_LINK_CD) AS AF_LINK_NM
+				    A.AF_LINK_CD
+				    , B.AF_LINK_NM
 				    , SUM(A.CHANNEL_AMT) AS CHANNEL_AMT
 				    , SUM(A.CHANNEL_AMT - A.CNCL_AMT - A.RTN_AMT) AS TOT_AMT /* 총매출 */
 				    , SUM(A.SELL_QTY) AS SELL_QTY  /* 판매수량 */
@@ -546,47 +585,15 @@
 				    , SUM(A.REAL_ORD_AMT) AS REAL_ORD_AMT /* 실결제금액 */
 				    , (SELECT FEE_RATE FROM TB_AF_LINK X WHERE X.AF_LINK_CD = A.AF_LINK_CD) AS SELL_FEE_RATE
 				    , (SUM(A.REAL_ORD_AMT) * (1 - (SELECT FEE_RATE FROM TB_AF_LINK X WHERE X.AF_LINK_CD = A.AF_LINK_CD) / 100)) AS EX_USAC_AMT
-					, IFNULL((SELECT SUM(X.CHANNEL_AMT - X.CNCL_AMT - X.RTN_AMT)
-				                FROM TB_STAT_ORD_DAY X
-				               WHERE 1=1
-				                 AND X.AF_LINK_CD = A.AF_LINK_CD
-							<![CDATA[
-							     AND X.DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
-							     AND X.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)
-							]]>
-							<if test="multiFrontGb != null">
-								/* 디바이스 */
-								<foreach collection="multiFrontGb" item="item" index="index"  open="AND X.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiFormalGb != null">
-								/* 정상/이월구분 */
-								<foreach collection="multiFormalGb" item="item" index="index"  open="AND X.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiDistributionGb != null">
-								/* 물류구분 */
-								<foreach collection="multiDistributionGb" item="item" index="index"  open="AND X.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiSupplyCompCd != null">
-								/* 공급처 */
-								<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND X.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiItemkindCd != null">
-								/* 품목 */
-								<foreach collection="multiItemkindCd" item="item" index="index"  open="AND X.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-				              ),0)                                           AS YOY_TOT_ORD_AMT /*전년동기대비매출액*/
+				    , SUM(IFNULL(C.YOY_TOT_ORD_AMT,0)) AS YOY_TOT_ORD_AMT
 				FROM TB_STAT_ORD_DAY A
-				WHERE 1=1
+				INNER JOIN TB_AF_LINK B ON A.AF_LINK_CD = B.AF_LINK_CD
+				LEFT OUTER JOIN YOY   C ON A.AF_LINK_CD = C.AF_LINK_CD
+				WHERE B.AF_CHANNEL != 'G053_01'
 				<![CDATA[
-				    AND DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
-				    AND DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)
+				    AND A.DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
+				    AND A.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)
 				]]>
-				    AND EXISTS(
-				          SELECT 1
-				          FROM TB_AF_LINK X
-				          WHERE X.AF_LINK_CD = A.AF_LINK_CD
-				            AND X.AF_CHANNEL != 'G053_01'
-				      )
 				<if test="multiFrontGb != null">
 					/* 디바이스 */
 					<foreach collection="multiFrontGb" item="item" index="index"  open="AND A.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
@@ -608,7 +615,6 @@
 					<foreach collection="multiItemkindCd" item="item" index="index"  open="AND A.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
 				</if>
 				GROUP BY AF_LINK_CD
-
 	) TAB
 	ORDER BY AF_LINK_NM
 	</select>
@@ -616,6 +622,48 @@
 	<!-- 브랜드 주문목록 조회 -->
 	<select id="getBrandOrderList" parameterType="Statistics" resultType="Statistics">
 		/* TsaStatistics.getBrandOrderList */
+		WITH YOY AS (
+		  SELECT X.BRAND_CD, SUM(X.SELF_AMT + X.CHANNEL_AMT + X.EXTMALL_AMT - X.CNCL_AMT - X.RTN_AMT) AS YOY_TOT_ORD_AMT
+		    FROM TB_STAT_ORD_DAY X
+		   WHERE 1=1
+			<![CDATA[
+		     AND X.DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
+		     AND X.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)
+			]]>
+			<if test="multiFrontGb != null">
+				/* 디바이스 */
+				<foreach collection="multiFrontGb" item="item" index="index"  open="AND X.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiFormalGb != null">
+				/* 정상/이월구분 */
+				<foreach collection="multiFormalGb" item="item" index="index"  open="AND X.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiDistributionGb != null">
+				/* 물류구분 */
+				<foreach collection="multiDistributionGb" item="item" index="index"  open="AND X.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiSupplyCompCd != null">
+				/* 공급처 */
+				<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND X.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiItemkindCd != null">
+				/* 품목 */
+				<foreach collection="multiItemkindCd" item="item" index="index"  open="AND X.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiExtmallId != null">
+				/* 제휴몰 */
+				<foreach collection="multiExtmallId" item="item" index="index"  open="AND X.EXTMALL_ID IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiAfLinkCd != null">
+				/* 채널 */
+				<foreach collection="multiAfLinkCd" item="item" index="index"  open="AND X.AF_LINK_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+			<if test="multiBrandCd != null">
+				/* 브랜드 */
+				<foreach collection="multiBrandCd" item="item" index="index"  open="AND Y.BRAND_CD IN (" close=")" separator=",">#{item}</foreach>
+			</if>
+		  GROUP BY X.BRAND_CD
+		)
 		SELECT
 		    BRAND_CD /*브랜드코드*/
 		    , BRAND_ENM /*브랜드명*/
@@ -627,7 +675,9 @@
 		    , TOT_AMT_10 /*정상매출*/
 		    , TOT_AMT_20 /*이월매출*/
 		    , ROUND( ((FLOOR(TOT_AMT_10 / TOT_AMT * 10000 / 10)) / 10), 1) AS AMT_RATE_10 /*정상비*/
-		    , ROUND(IF(TOT_AMT = 0, 1, TOT_AMT) / IF(YOY_TOT_ORD_AMT = 0, 1, YOY_TOT_ORD_AMT) * 100 - 100,1) AS YOY_RATE /*증가율*/
+		    , CASE WHEN TOT_AMT > 0 AND YOY_TOT_ORD_AMT > 0 THEN ROUND(TOT_AMT / YOY_TOT_ORD_AMT * 100 - 100,1)
+		           ELSE NULL
+		            END AS YOY_RATE /*증가율*/
 		    , YOY_TOT_ORD_AMT
 		FROM (
 		    SELECT
@@ -641,7 +691,7 @@
 		        , SUM(CNCL_AMT) AS CNCL_AMT
 		        , SUM(CASE WHEN FORMAL_GB = 'G009_10' THEN TOT_AMT ELSE 0 END) AS TOT_AMT_10 /*정상매출*/
 		        , SUM(CASE WHEN FORMAL_GB = 'G009_20' THEN TOT_AMT ELSE 0 END) AS TOT_AMT_20 /*이월매출*/
-		        , X.YOY_TOT_ORD_AMT
+		        , YOY_TOT_ORD_AMT
 		    FROM (
 		        SELECT
 		            A.BRAND_CD -- 브랜드코드
@@ -653,48 +703,10 @@
 		            , SUM(A.SELF_AMT + A.CHANNEL_AMT) AS SELFMALL_AMT -- 자사몰매출
 		            , SUM(A.EXTMALL_AMT) AS EXTMALL_AMT -- 제휴몰매출
 		            , SUM(A.CNCL_AMT + A.RTN_AMT) AS CNCL_AMT -- 취/반품액
-					, IFNULL((SELECT SUM(X.TOT_AMT)
-				                FROM TB_STAT_ORD_DAY X
-				               WHERE A.BRAND_CD = X.BRAND_CD
-							<![CDATA[
-							     AND X.DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
-							     AND X.DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)
-							]]>
-							<if test="multiFrontGb != null">
-								/* 디바이스 */
-								<foreach collection="multiFrontGb" item="item" index="index"  open="AND X.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiFormalGb != null">
-								/* 정상/이월구분 */
-								<foreach collection="multiFormalGb" item="item" index="index"  open="AND X.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiDistributionGb != null">
-								/* 물류구분 */
-								<foreach collection="multiDistributionGb" item="item" index="index"  open="AND X.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiSupplyCompCd != null">
-								/* 공급처 */
-								<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND X.SUPPLY_COMP_CD IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiItemkindCd != null">
-								/* 품목 */
-								<foreach collection="multiItemkindCd" item="item" index="index"  open="AND X.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiExtmallId != null">
-								/* 제휴몰 */
-								<foreach collection="multiExtmallId" item="item" index="index"  open="AND X.EXTMALL_ID IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiAfLinkCd != null">
-								/* 채널 */
-								<foreach collection="multiAfLinkCd" item="item" index="index"  open="AND X.AF_LINK_CD IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-							<if test="multiBrandCd != null">
-								/* 브랜드 */
-								<foreach collection="multiBrandCd" item="item" index="index"  open="AND Y.BRAND_CD IN (" close=")" separator=",">#{item}</foreach>
-							</if>
-				              ),0)                                           AS YOY_TOT_ORD_AMT /*전년동기대비매출액*/
-		        FROM TB_STAT_ORD_DAY A, TB_BRAND B
+		            , C.YOY_TOT_ORD_AMT
+		        FROM TB_STAT_ORD_DAY A, TB_BRAND B, YOY C
 		        WHERE A.BRAND_CD = B.BRAND_CD
+		          AND A.BRAND_CD = C.BRAND_CD
 				<![CDATA[
 			      AND DAY >= STR_TO_DATE(#{startDt},'%Y-%m-%d')
 			      AND DAY <= DATE_ADD(STR_TO_DATE(#{endDt},'%Y-%m-%d'), INTERVAL 1 DAY)

+ 3 - 3
src/main/webapp/WEB-INF/views/statistics/BrandTradingForm.html

@@ -129,19 +129,19 @@
 	let columnDefs = [
 		{ headerName: "브랜드번호", field: "brandCd", width: 100, cellClass: 'text-center' },
 		{ headerName: "브랜드명", field: "brandEnm", width: 180, cellClass: 'text-center'},
-		{ headerName: "브랜드 매출액", field: "", width: 120, cellClass: 'text-center',
+		{ headerName: "브랜드 매출액", field: "", width: 120, cellClass: 'text-right',
 			children: [
 				{headerName: "총매출액(A+B+C)", field: "totAmt", width: 120, cellClass: 'text-center',
 					cellRenderer: function(params) {
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}
 				},
-				{headerName: "판매 개수", field: "sellQty", width: 120, cellClass: 'text-left',
+				{headerName: "판매 개수", field: "sellQty", width: 120, cellClass: 'text-right',
 					cellRenderer: function(params) {
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}
 				},
-				{headerName: "YOY(%)", field: "yoyRate", width: 100, cellClass: 'text-left',
+				{headerName: "YOY(%)", field: "yoyRate", width: 100, cellClass: 'text-right',
 					cellRenderer: function(params) {
 						return params.value +'%';
 					}

+ 1 - 3
src/main/webapp/WEB-INF/views/statistics/ChannelTradingForm.html

@@ -373,13 +373,11 @@
 				if( typeof rowNode.data.realOrdAmt   == 'number') { totInfo.realOrdAmt   += rowNode.data.realOrdAmt   ; }
 				if( typeof rowNode.data.sellFeeRate  == 'number') { totInfo.sellFeeRate  += rowNode.data.sellFeeRate  ; }
 				if( typeof rowNode.data.exUsacAmt    == 'number') { totInfo.exUsacAmt    += rowNode.data.exUsacAmt    ; }
-				if( typeof rowNode.data.yoyTotOrdAmt == 'number') { totInfo.yoyTotOrdAmt +=  rowNode.data.yoyTotOrdAmt; }
+				if( typeof rowNode.data.yoyTotOrdAmt == 'number') { totInfo.yoyTotOrdAmt += rowNode.data.yoyTotOrdAmt ; }
 			}
 		});
 
 		//값이 0이면 제수가 0이므로 오류방지처리
-		if(totInfo.totAmt == 0) totInfo.totAmt = 1;
-		if(totInfo.yoyTotOrdAmt == 0) totInfo.yoyTotOrdAmt = 1;
 		totInfo.yoyRate = (totInfo.totAmt / totInfo.yoyTotOrdAmt * 100 - 100).toFixed(1);
 
 		gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');

+ 5 - 3
src/main/webapp/WEB-INF/views/statistics/ExtmallTradingForm.html

@@ -317,9 +317,11 @@
 		});
 
 		//값이 0이면 제수가 0이므로 오류방지처리
-		if(totInfo.totAmt == 0) totInfo.totAmt = 1;
-		if(totInfo.yoyTotOrdAmt == 0) totInfo.yoyTotOrdAmt = 1;
-		totInfo.yoyRate = (totInfo.totAmt / totInfo.yoyTotOrdAmt * 100 - 100).toFixed(1);
+		if(totInfo.totAmt > 0 && totInfo.yoyTotOrdAmt > 0){
+			totInfo.yoyRate = (totInfo.totAmt / totInfo.yoyTotOrdAmt * 100 - 100).toFixed(1);
+		}else{
+			totInfo.yoyRate = 0;
+		}
 
 		gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');
 	}