<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="BapMessageDaily">

	<statement id="selectListCount" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT COUNT(*) AS "TOTALCOUNT"
             ,  SUM(DDTRSMTNOITM1)	AS "DDTRSMTNOITM1_SUM"
             ,  SUM(DDERRNOITM1)	AS "DDERRNOITM1_SUM"
             ,  SUM(DDTRSMTNOITM2)	AS "DDTRSMTNOITM2_SUM"
             ,  SUM(DDERRNOITM2)	AS "DDERRNOITM2_SUM"
             ,  SUM(DDTRSMTNOITM3)	AS "DDTRSMTNOITM3_SUM"
             ,  SUM(DDERRNOITM3)	AS "DDERRNOITM3_SUM"
             ,  SUM(DDTRSMTNOITM4)	AS "DDTRSMTNOITM4_SUM"
             ,  SUM(DDERRNOITM4)	AS "DDERRNOITM4_SUM"
             ,  SUM(DDTRSMTNOITM5)	AS "DDTRSMTNOITM5_SUM"
             ,  SUM(DDERRNOITM5)	AS "DDERRNOITM5_SUM"
             ,  SUM(DDTRSMTNOITM6)	AS "DDTRSMTNOITM6_SUM"
             ,  SUM(DDERRNOITM6)	AS "DDERRNOITM6_SUM"
             ,  SUM(DDTRSMTNOITM7)	AS "DDTRSMTNOITM7_SUM"
             ,  SUM(DDERRNOITM7)	AS "DDERRNOITM7_SUM"
             ,  SUM(DDTRSMTNOITM8)	AS "DDTRSMTNOITM8_SUM"
             ,  SUM(DDERRNOITM8)	AS "DDERRNOITM8_SUM"
             ,  SUM(DDTRSMTNOITM9)	AS "DDTRSMTNOITM9_SUM"
             ,  SUM(DDERRNOITM9)	AS "DDERRNOITM9_SUM"
             ,  SUM(DDTRSMTNOITM10)	AS "DDTRSMTNOITM10_SUM"
             ,  SUM(DDERRNOITM10)	AS "DDERRNOITM10_SUM"
             ,  SUM(DDTRSMTNOITM11)	AS "DDTRSMTNOITM11_SUM"
             ,  SUM(DDERRNOITM11)	AS "DDERRNOITM11_SUM"
             ,  SUM(DDTRSMTNOITM12)	AS "DDTRSMTNOITM12_SUM"
             ,  SUM(DDERRNOITM12)	AS "DDERRNOITM12_SUM"
             ,  SUM(DDTRSMTNOITM13)	AS "DDTRSMTNOITM13_SUM"
             ,  SUM(DDERRNOITM13)	AS "DDERRNOITM13_SUM"
             ,  SUM(DDTRSMTNOITM14)	AS "DDTRSMTNOITM14_SUM"
             ,  SUM(DDERRNOITM14)	AS "DDERRNOITM14_SUM"
             ,  SUM(DDTRSMTNOITM15)	AS "DDTRSMTNOITM15_SUM"
             ,  SUM(DDERRNOITM15)	AS "DDERRNOITM15_SUM"
             ,  SUM(DDTRSMTNOITM16)	AS "DDTRSMTNOITM16_SUM"
             ,  SUM(DDERRNOITM16)	AS "DDERRNOITM16_SUM"
             ,  SUM(DDTRSMTNOITM17)	AS "DDTRSMTNOITM17_SUM"
             ,  SUM(DDERRNOITM17)	AS "DDERRNOITM17_SUM"
             ,  SUM(DDTRSMTNOITM18)	AS "DDTRSMTNOITM18_SUM"
             ,  SUM(DDERRNOITM18)	AS "DDERRNOITM18_SUM"
             ,  SUM(DDTRSMTNOITM19)	AS "DDTRSMTNOITM19_SUM"
             ,  SUM(DDERRNOITM19)	AS "DDERRNOITM19_SUM"
             ,  SUM(DDTRSMTNOITM20)	AS "DDTRSMTNOITM20_SUM"
             ,  SUM(DDERRNOITM20)	AS "DDERRNOITM20_SUM"
             ,  SUM(DDTRSMTNOITM21)	AS "DDTRSMTNOITM21_SUM"
             ,  SUM(DDERRNOITM21)	AS "DDERRNOITM21_SUM"
             ,  SUM(DDTRSMTNOITM22)	AS "DDTRSMTNOITM22_SUM"
             ,  SUM(DDERRNOITM22)	AS "DDERRNOITM22_SUM"
             ,  SUM(DDTRSMTNOITM23)	AS "DDTRSMTNOITM23_SUM"
             ,  SUM(DDERRNOITM23)	AS "DDERRNOITM23_SUM"
             ,  SUM(DDTRSMTNOITM24)	AS "DDTRSMTNOITM24_SUM"
             ,  SUM(DDERRNOITM24)	AS "DDERRNOITM24_SUM"
             ,  SUM(DDTRSMTNOITM25)	AS "DDTRSMTNOITM25_SUM"
             ,  SUM(DDERRNOITM25)	AS "DDERRNOITM25_SUM"
             ,  SUM(DDTRSMTNOITM26)	AS "DDTRSMTNOITM26_SUM"
             ,  SUM(DDERRNOITM26)	AS "DDERRNOITM26_SUM"
             ,  SUM(DDTRSMTNOITM27)	AS "DDTRSMTNOITM27_SUM"
             ,  SUM(DDERRNOITM27)	AS "DDERRNOITM27_SUM"
             ,  SUM(DDTRSMTNOITM28)	AS "DDTRSMTNOITM28_SUM"
             ,  SUM(DDERRNOITM28)	AS "DDERRNOITM28_SUM"
             ,  SUM(DDTRSMTNOITM29)	AS "DDTRSMTNOITM29_SUM"
             ,  SUM(DDERRNOITM29)	AS "DDERRNOITM29_SUM"
             ,  SUM(DDTRSMTNOITM30)	AS "DDTRSMTNOITM30_SUM"
             ,  SUM(DDERRNOITM30)	AS "DDERRNOITM30_SUM"
             ,  SUM(DDTRSMTNOITM31)	AS "DDTRSMTNOITM31_SUM"
             ,  SUM(DDERRNOITM31)	AS "DDERRNOITM31_SUM"  		
          FROM (
				SELECT
			        NVL(SUM(CASE WHEN DD = '01' THEN ProcCount END), 0)    AS "DDTRSMTNOITM1" 
			      , NVL(SUM(CASE WHEN DD = '01' THEN ErrCount END), 0)     AS "DDERRNOITM1"   
			      , NVL(SUM(CASE WHEN DD = '02' THEN ProcCount END), 0)    AS "DDTRSMTNOITM2" 
			      , NVL(SUM(CASE WHEN DD = '02' THEN ErrCount END), 0)     AS "DDERRNOITM2"   
			      , NVL(SUM(CASE WHEN DD = '03' THEN ProcCount END), 0)    AS "DDTRSMTNOITM3" 
			      , NVL(SUM(CASE WHEN DD = '03' THEN ErrCount END), 0)     AS "DDERRNOITM3"   
			      , NVL(SUM(CASE WHEN DD = '04' THEN ProcCount END), 0)    AS "DDTRSMTNOITM4" 
			      , NVL(SUM(CASE WHEN DD = '04' THEN ErrCount END), 0)     AS "DDERRNOITM4"   
			      , NVL(SUM(CASE WHEN DD = '05' THEN ProcCount END), 0)    AS "DDTRSMTNOITM5" 
			      , NVL(SUM(CASE WHEN DD = '05' THEN ErrCount END), 0)     AS "DDERRNOITM5"   
			      , NVL(SUM(CASE WHEN DD = '06' THEN ProcCount END), 0)    AS "DDTRSMTNOITM6" 
			      , NVL(SUM(CASE WHEN DD = '06' THEN ErrCount END), 0)     AS "DDERRNOITM6"   
			      , NVL(SUM(CASE WHEN DD = '07' THEN ProcCount END), 0)    AS "DDTRSMTNOITM7" 
			      , NVL(SUM(CASE WHEN DD = '07' THEN ErrCount END), 0)     AS "DDERRNOITM7"   
			      , NVL(SUM(CASE WHEN DD = '08' THEN ProcCount END), 0)    AS "DDTRSMTNOITM8" 
			      , NVL(SUM(CASE WHEN DD = '08' THEN ErrCount END), 0)     AS "DDERRNOITM8"   
			      , NVL(SUM(CASE WHEN DD = '09' THEN ProcCount END), 0)    AS "DDTRSMTNOITM9" 
			      , NVL(SUM(CASE WHEN DD = '09' THEN ErrCount END), 0)     AS "DDERRNOITM9"   
			      , NVL(SUM(CASE WHEN DD = '10' THEN ProcCount END), 0)    AS "DDTRSMTNOITM10"
			      , NVL(SUM(CASE WHEN DD = '10' THEN ErrCount END), 0)     AS "DDERRNOITM10"  
			      , NVL(SUM(CASE WHEN DD = '11' THEN ProcCount END), 0)    AS "DDTRSMTNOITM11"
			      , NVL(SUM(CASE WHEN DD = '11' THEN ErrCount END), 0)     AS "DDERRNOITM11"  
			      , NVL(SUM(CASE WHEN DD = '12' THEN ProcCount END), 0)    AS "DDTRSMTNOITM12"
			      , NVL(SUM(CASE WHEN DD = '12' THEN ErrCount END), 0)     AS "DDERRNOITM12"  
			      , NVL(SUM(CASE WHEN DD = '13' THEN ProcCount END), 0)    AS "DDTRSMTNOITM13"
			      , NVL(SUM(CASE WHEN DD = '13' THEN ErrCount END), 0)     AS "DDERRNOITM13"  
			      , NVL(SUM(CASE WHEN DD = '14' THEN ProcCount END), 0)    AS "DDTRSMTNOITM14"
			      , NVL(SUM(CASE WHEN DD = '14' THEN ErrCount END), 0)     AS "DDERRNOITM14"  
			      , NVL(SUM(CASE WHEN DD = '15' THEN ProcCount END), 0)    AS "DDTRSMTNOITM15"
			      , NVL(SUM(CASE WHEN DD = '15' THEN ErrCount END), 0)     AS "DDERRNOITM15"  
			      , NVL(SUM(CASE WHEN DD = '16' THEN ProcCount END), 0)    AS "DDTRSMTNOITM16"
			      , NVL(SUM(CASE WHEN DD = '16' THEN ErrCount END), 0)     AS "DDERRNOITM16"  
			      , NVL(SUM(CASE WHEN DD = '17' THEN ProcCount END), 0)    AS "DDTRSMTNOITM17"
			      , NVL(SUM(CASE WHEN DD = '17' THEN ErrCount END), 0)     AS "DDERRNOITM17"  
			      , NVL(SUM(CASE WHEN DD = '18' THEN ProcCount END), 0)    AS "DDTRSMTNOITM18"
			      , NVL(SUM(CASE WHEN DD = '18' THEN ErrCount END), 0)     AS "DDERRNOITM18"  
			      , NVL(SUM(CASE WHEN DD = '19' THEN ProcCount END), 0)    AS "DDTRSMTNOITM19"
			      , NVL(SUM(CASE WHEN DD = '19' THEN ErrCount END), 0)     AS "DDERRNOITM19"  
			      , NVL(SUM(CASE WHEN DD = '20' THEN ProcCount END), 0)    AS "DDTRSMTNOITM20"
			      , NVL(SUM(CASE WHEN DD = '20' THEN ErrCount END), 0)     AS "DDERRNOITM20"  
			      , NVL(SUM(CASE WHEN DD = '21' THEN ProcCount END), 0)    AS "DDTRSMTNOITM21"
			      , NVL(SUM(CASE WHEN DD = '21' THEN ErrCount END), 0)     AS "DDERRNOITM21"  
			      , NVL(SUM(CASE WHEN DD = '22' THEN ProcCount END), 0)    AS "DDTRSMTNOITM22"
			      , NVL(SUM(CASE WHEN DD = '22' THEN ErrCount END), 0)     AS "DDERRNOITM22"  
			      , NVL(SUM(CASE WHEN DD = '23' THEN ProcCount END), 0)    AS "DDTRSMTNOITM23"
			      , NVL(SUM(CASE WHEN DD = '23' THEN ErrCount END), 0)     AS "DDERRNOITM23"  
			      , NVL(SUM(CASE WHEN DD = '24' THEN ProcCount END), 0)    AS "DDTRSMTNOITM24"
			      , NVL(SUM(CASE WHEN DD = '24' THEN ErrCount END), 0)     AS "DDERRNOITM24"  
			      , NVL(SUM(CASE WHEN DD = '25' THEN ProcCount END), 0)    AS "DDTRSMTNOITM25"
			      , NVL(SUM(CASE WHEN DD = '25' THEN ErrCount END), 0)     AS "DDERRNOITM25"  
			      , NVL(SUM(CASE WHEN DD = '26' THEN ProcCount END), 0)    AS "DDTRSMTNOITM26"
			      , NVL(SUM(CASE WHEN DD = '26' THEN ErrCount END), 0)     AS "DDERRNOITM26"  
			      , NVL(SUM(CASE WHEN DD = '27' THEN ProcCount END), 0)    AS "DDTRSMTNOITM27"
			      , NVL(SUM(CASE WHEN DD = '27' THEN ErrCount END), 0)     AS "DDERRNOITM27"  
			      , NVL(SUM(CASE WHEN DD = '28' THEN ProcCount END), 0)    AS "DDTRSMTNOITM28"
			      , NVL(SUM(CASE WHEN DD = '28' THEN ErrCount END), 0)     AS "DDERRNOITM28"  
			      , NVL(SUM(CASE WHEN DD = '29' THEN ProcCount END), 0)    AS "DDTRSMTNOITM29"
			      , NVL(SUM(CASE WHEN DD = '29' THEN ErrCount END), 0)     AS "DDERRNOITM29"  
			      , NVL(SUM(CASE WHEN DD = '30' THEN ProcCount END), 0)    AS "DDTRSMTNOITM30"
			      , NVL(SUM(CASE WHEN DD = '30' THEN ErrCount END), 0)     AS "DDERRNOITM30"  
			      , NVL(SUM(CASE WHEN DD = '31' THEN ProcCount END), 0)    AS "DDTRSMTNOITM31"
			      , NVL(SUM(CASE WHEN DD = '31' THEN ErrCount END), 0)     AS "DDERRNOITM31"  
				FROM
			        (
					SELECT
			                SUBSTR(ES01.SNDSTARTDATE, 1, 6) AS STATCYM
			              , SUBSTR(ES01.SNDSTARTDATE, 7, 2) AS DD
			              , ES01.INTFID
			              , EA04.INTFNAME
			              , EA04.WORKGRPCD		     
			              , SUM(CASE WHEN ES01.ERRYN = 'C' THEN 1 ELSE 0 END) AS ProcCount
			              , SUM(CASE WHEN ES01.ERRYN = 'C' THEN 0 ELSE 1 END) AS ErrCount
			        FROM  $schemaId$.TSEAIES01 ES01, $schemaId$.TSEAIEA04 EA04
			        WHERE ES01.SNDSTARTDATE &gt;= #searchStart# || '0000000000'
			        AND   ES01.SNDSTARTDATE &lt;= #searchEnd# || '9999999999'
			        AND   EA04.INTFID = ES01.INTFID
					<isNotEmpty prepend="AND" property="searchIntfId">
						(  TRIM(EA04.INTFID) LIKE CONCAT( '%',CONCAT( UPPER(#searchIntfId#) , '%') ) OR
							  EA04.INTFNAME LIKE CONCAT( '%',CONCAT( UPPER(#searchIntfId#) , '%') )   )
					</isNotEmpty>	
					<isNotEmpty prepend="AND" property="searchEaiBzwkDstcd">
						(  EA04.WORKGRPCD = UPPER(#searchEaiBzwkDstcd#)  )
					</isNotEmpty>			 			        
			        GROUP BY
			                SUBSTR(ES01.SNDSTARTDATE, 1, 6)
			              , SUBSTR(ES01.SNDSTARTDATE, 7, 2)
			              , ES01.INTFID
			              , EA04.INTFNAME
			              , EA04.WORKGRPCD
			        ) TMP1
			GROUP BY STATCYM, INTFID, INTFNAME, WORKGRPCD
		)
   </statement>
  
  <statement id="selectByIntfIdDaily" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT
		        STATCYM
		      , WORKGRPCD
		      , (SELECT BZWKDSTICDESC FROM $schemaId$.TSEAICM01 WHERE EAIBZWKDSTCD =  TMP1.WORKGRPCD) BJOBBZWKNAME
		      , INTFID
		      , INTFNAME
		      , NVL(SUM(CASE WHEN DD = '01' THEN ProcCount END), 0)    AS "DDTRSMTNOITM1" 
		      , NVL(SUM(CASE WHEN DD = '01' THEN ErrCount END), 0)     AS "DDERRNOITM1"   
		      , NVL(SUM(CASE WHEN DD = '02' THEN ProcCount END), 0)    AS "DDTRSMTNOITM2" 
		      , NVL(SUM(CASE WHEN DD = '02' THEN ErrCount END), 0)     AS "DDERRNOITM2"   
		      , NVL(SUM(CASE WHEN DD = '03' THEN ProcCount END), 0)    AS "DDTRSMTNOITM3" 
		      , NVL(SUM(CASE WHEN DD = '03' THEN ErrCount END), 0)     AS "DDERRNOITM3"   
		      , NVL(SUM(CASE WHEN DD = '04' THEN ProcCount END), 0)    AS "DDTRSMTNOITM4" 
		      , NVL(SUM(CASE WHEN DD = '04' THEN ErrCount END), 0)     AS "DDERRNOITM4"   
		      , NVL(SUM(CASE WHEN DD = '05' THEN ProcCount END), 0)    AS "DDTRSMTNOITM5" 
		      , NVL(SUM(CASE WHEN DD = '05' THEN ErrCount END), 0)     AS "DDERRNOITM5"   
		      , NVL(SUM(CASE WHEN DD = '06' THEN ProcCount END), 0)    AS "DDTRSMTNOITM6" 
		      , NVL(SUM(CASE WHEN DD = '06' THEN ErrCount END), 0)     AS "DDERRNOITM6"   
		      , NVL(SUM(CASE WHEN DD = '07' THEN ProcCount END), 0)    AS "DDTRSMTNOITM7" 
		      , NVL(SUM(CASE WHEN DD = '07' THEN ErrCount END), 0)     AS "DDERRNOITM7"   
		      , NVL(SUM(CASE WHEN DD = '08' THEN ProcCount END), 0)    AS "DDTRSMTNOITM8" 
		      , NVL(SUM(CASE WHEN DD = '08' THEN ErrCount END), 0)     AS "DDERRNOITM8"   
		      , NVL(SUM(CASE WHEN DD = '09' THEN ProcCount END), 0)    AS "DDTRSMTNOITM9" 
		      , NVL(SUM(CASE WHEN DD = '09' THEN ErrCount END), 0)     AS "DDERRNOITM9"   
		      , NVL(SUM(CASE WHEN DD = '10' THEN ProcCount END), 0)    AS "DDTRSMTNOITM10"
		      , NVL(SUM(CASE WHEN DD = '10' THEN ErrCount END), 0)     AS "DDERRNOITM10"  
		      , NVL(SUM(CASE WHEN DD = '11' THEN ProcCount END), 0)    AS "DDTRSMTNOITM11"
		      , NVL(SUM(CASE WHEN DD = '11' THEN ErrCount END), 0)     AS "DDERRNOITM11"  
		      , NVL(SUM(CASE WHEN DD = '12' THEN ProcCount END), 0)    AS "DDTRSMTNOITM12"
		      , NVL(SUM(CASE WHEN DD = '12' THEN ErrCount END), 0)     AS "DDERRNOITM12"  
		      , NVL(SUM(CASE WHEN DD = '13' THEN ProcCount END), 0)    AS "DDTRSMTNOITM13"
		      , NVL(SUM(CASE WHEN DD = '13' THEN ErrCount END), 0)     AS "DDERRNOITM13"  
		      , NVL(SUM(CASE WHEN DD = '14' THEN ProcCount END), 0)    AS "DDTRSMTNOITM14"
		      , NVL(SUM(CASE WHEN DD = '14' THEN ErrCount END), 0)     AS "DDERRNOITM14"  
		      , NVL(SUM(CASE WHEN DD = '15' THEN ProcCount END), 0)    AS "DDTRSMTNOITM15"
		      , NVL(SUM(CASE WHEN DD = '15' THEN ErrCount END), 0)     AS "DDERRNOITM15"  
		      , NVL(SUM(CASE WHEN DD = '16' THEN ProcCount END), 0)    AS "DDTRSMTNOITM16"
		      , NVL(SUM(CASE WHEN DD = '16' THEN ErrCount END), 0)     AS "DDERRNOITM16"  
		      , NVL(SUM(CASE WHEN DD = '17' THEN ProcCount END), 0)    AS "DDTRSMTNOITM17"
		      , NVL(SUM(CASE WHEN DD = '17' THEN ErrCount END), 0)     AS "DDERRNOITM17"  
		      , NVL(SUM(CASE WHEN DD = '18' THEN ProcCount END), 0)    AS "DDTRSMTNOITM18"
		      , NVL(SUM(CASE WHEN DD = '18' THEN ErrCount END), 0)     AS "DDERRNOITM18"  
		      , NVL(SUM(CASE WHEN DD = '19' THEN ProcCount END), 0)    AS "DDTRSMTNOITM19"
		      , NVL(SUM(CASE WHEN DD = '19' THEN ErrCount END), 0)     AS "DDERRNOITM19"  
		      , NVL(SUM(CASE WHEN DD = '20' THEN ProcCount END), 0)    AS "DDTRSMTNOITM20"
		      , NVL(SUM(CASE WHEN DD = '20' THEN ErrCount END), 0)     AS "DDERRNOITM20"  
		      , NVL(SUM(CASE WHEN DD = '21' THEN ProcCount END), 0)    AS "DDTRSMTNOITM21"
		      , NVL(SUM(CASE WHEN DD = '21' THEN ErrCount END), 0)     AS "DDERRNOITM21"  
		      , NVL(SUM(CASE WHEN DD = '22' THEN ProcCount END), 0)    AS "DDTRSMTNOITM22"
		      , NVL(SUM(CASE WHEN DD = '22' THEN ErrCount END), 0)     AS "DDERRNOITM22"  
		      , NVL(SUM(CASE WHEN DD = '23' THEN ProcCount END), 0)    AS "DDTRSMTNOITM23"
		      , NVL(SUM(CASE WHEN DD = '23' THEN ErrCount END), 0)     AS "DDERRNOITM23"  
		      , NVL(SUM(CASE WHEN DD = '24' THEN ProcCount END), 0)    AS "DDTRSMTNOITM24"
		      , NVL(SUM(CASE WHEN DD = '24' THEN ErrCount END), 0)     AS "DDERRNOITM24"  
		      , NVL(SUM(CASE WHEN DD = '25' THEN ProcCount END), 0)    AS "DDTRSMTNOITM25"
		      , NVL(SUM(CASE WHEN DD = '25' THEN ErrCount END), 0)     AS "DDERRNOITM25"  
		      , NVL(SUM(CASE WHEN DD = '26' THEN ProcCount END), 0)    AS "DDTRSMTNOITM26"
		      , NVL(SUM(CASE WHEN DD = '26' THEN ErrCount END), 0)     AS "DDERRNOITM26"  
		      , NVL(SUM(CASE WHEN DD = '27' THEN ProcCount END), 0)    AS "DDTRSMTNOITM27"
		      , NVL(SUM(CASE WHEN DD = '27' THEN ErrCount END), 0)     AS "DDERRNOITM27"  
		      , NVL(SUM(CASE WHEN DD = '28' THEN ProcCount END), 0)    AS "DDTRSMTNOITM28"
		      , NVL(SUM(CASE WHEN DD = '28' THEN ErrCount END), 0)     AS "DDERRNOITM28"  
		      , NVL(SUM(CASE WHEN DD = '29' THEN ProcCount END), 0)    AS "DDTRSMTNOITM29"
		      , NVL(SUM(CASE WHEN DD = '29' THEN ErrCount END), 0)     AS "DDERRNOITM29"  
		      , NVL(SUM(CASE WHEN DD = '30' THEN ProcCount END), 0)    AS "DDTRSMTNOITM30"
		      , NVL(SUM(CASE WHEN DD = '30' THEN ErrCount END), 0)     AS "DDERRNOITM30"  
		      , NVL(SUM(CASE WHEN DD = '31' THEN ProcCount END), 0)    AS "DDTRSMTNOITM31"
		      , NVL(SUM(CASE WHEN DD = '31' THEN ErrCount END), 0)     AS "DDERRNOITM31"  
			FROM
		        (
				SELECT
		                SUBSTR(ES01.SNDSTARTDATE, 1, 6) AS STATCYM
		              , SUBSTR(ES01.SNDSTARTDATE, 7, 2) AS DD
		              , EA04.WORKGRPCD
		              , ES01.INTFID
		              , EA04.INTFNAME
		              , SUM(CASE WHEN ES01.ERRYN = 'C' THEN 1 ELSE 0 END) AS ProcCount
		              , SUM(CASE WHEN ES01.ERRYN = 'C' THEN 0 ELSE 1 END) AS ErrCount
		        FROM  $schemaId$.TSEAIES01 ES01, $schemaId$.TSEAIEA04 EA04
		        WHERE ES01.SNDSTARTDATE &gt;= #searchStart# || '0000000000'
		        AND   ES01.SNDSTARTDATE &lt;= #searchEnd# || '9999999999'
		        AND   EA04.INTFID = ES01.INTFID
				<isNotEmpty prepend="AND" property="searchIntfId">
					(  TRIM(EA04.INTFID) LIKE CONCAT( '%',CONCAT( UPPER(#searchIntfId#) , '%') ) OR
						  EA04.INTFNAME LIKE CONCAT( '%',CONCAT( UPPER(#searchIntfId#) , '%') )   )
				</isNotEmpty>	
				<isNotEmpty prepend="AND" property="searchEaiBzwkDstcd">
					(  EA04.WORKGRPCD = UPPER(#searchEaiBzwkDstcd#)  )
				</isNotEmpty>			 		        
		        GROUP BY
		                SUBSTR(ES01.SNDSTARTDATE, 1, 6)
		              , SUBSTR(ES01.SNDSTARTDATE, 7, 2)
		              , ES01.INTFID
		              , EA04.INTFNAME
		              , EA04.WORKGRPCD
		        ) TMP1
		GROUP BY STATCYM, INTFID, INTFNAME, WORKGRPCD
		
   </statement>
</sqlMap>
