<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-2.dtd">
    
<sqlMap namespace="BapTranStatus">
    <statement id="list_e" resultClass="java.util.HashMap">
        SELECT A.BjobDmndMsgID                AS BJOBDMNDMSGID,
               A.BjobDmndSubMsgID             AS BJOBDMNDSUBMSGID,
               A.BjobDmndMsgCretnHMS          AS BJOBDMNDMSGCRETNHMS,
               A.BjobBzwkDstcd                AS BJOBBZWKDSTCD,
               C.BjobBzwkName                 AS BJOBBZWKNAME,
               A.OsidInstiDstcd               AS OSIDINSTIDSTCD,
               D.OsidInstiName                AS OSIDINSTINAME,
               SUBSTR(A.BjobPtrnDstcd,2,1)    AS SENDRECVYN,
               CASE WHEN B.TranStartHMS is null OR B.TranStartHMS  = '' 
                         THEN A.TranStartHMS 
                    ELSE B.TranStartHMS END   AS TRANSTARTHMS,
               CASE WHEN B.TranEndHMS is null OR B.TranEndHMS  = '' 
                         THEN A.TranEndHMS
                    ELSE B.TranEndHMS END     AS TRANENDHMS,
               B.BjobMsgDstcd                 AS BJOBMSGDSTCD,
               B.BjobMsgDstcdSeq              AS BJOBMSGDSTCDSEQ,
               B.BaseYmd                      AS BASEYMD,
               CASE WHEN B.ThisStgePrcssRsultCd is null OR B.ThisStgePrcssRsultCd  = ''
                         THEN A.TranPrcssDstcd 
                    ELSE B.ThisStgePrcssRsultCd END AS TRANPRCSSDSTCD,
               B.SndrcvFileName               AS SNDRCVFILENAME,
               B.SndrcvRecCnt                 AS SNDRCVRECCNT,
               B.SndrcvFileSize               AS SNDRCVFILESIZE,
               B.BjobTranDstcdName            AS BJOBTRANDSTCDNAME,
               IFNULL(B.GroupCoCd, ' ' ) AS GROUPCOCD,
               B.RQSTRECVFILESTORGDIRNAME, 
               B.BKUPSNDRCVFILENAME
        FROM   $schemaId$.TSEAIBJ03 A LEFT OUTER JOIN
               ( SELECT F.BjobDmndMsgID,
                        F.BjobDmndSubMsgID,
                        E.BjobMsgDstcd,
                        F.BjobMsgDstcdSeq,
                        SUBSTR( F.BKUPSNDRCVFILENAME, LENGTH(F.BKUPSNDRCVFILENAME) - 11, 8 ) AS BaseYmd,
                        F.SndrcvFileName,
                        F.SndrcvRecCnt,
                        F.SndrcvFileSize,
                        E.BjobTranDstcdName,
                        F.ThisStgePrcssRsultCd,
                        F.EAIObstclOccurCausCtnt,
                        F.FileTrsmtStartHMS AS TranStartHMS,
                        F.FileTrsmtEndHMS   AS TranEndHMS,
                        E.GroupCoCd,
                        F.RQSTRECVFILESTORGDIRNAME, 
                        F.BKUPSNDRCVFILENAME
                 FROM   $schemaId$.TSEAIBJ01 E JOIN $schemaId$.TSEAIBJ08 F 
                                               ON E.bjobmsgdstcd=F.bjobmsgdstcd 
                 WHERE  F.ThisStgePrcssRsultCd IN ( 'E', 'C', 'Q', 'S', 'H')
               ) B ON A.BjobDmndMsgID = B.BjobDmndMsgID AND A.BjobDmndSubMsgID = B.BjobDmndSubMsgID
                        LEFT OUTER JOIN $schemaId$.TSEAIBJ02 C ON A.BjobBzwkDstcd = C.BjobBzwkDstcd
                        LEFT OUTER JOIN $schemaId$.TSEAIBJ06 D ON A.BjobBzwkDstcd = D.BjobBzwkDstcd
                                                              AND A.OsidInstiDstcd = D.OsidInstiDstcd
        WHERE B.ThisStgePrcssRsultCd in ( 'E', 'C', 'Q', 'S', 'H')
        <isNotEmpty prepend="AND" property="searchBjobDmndMsgID">
            A.BjobDmndMsgID LIKE  CONCAT( #searchBjobDmndMsgID# , '%')
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchBbjobDmndSubMsgID">
            A.BjobDmndSubMsgID  LIKE  CONCAT( #searchBbjobDmndSubMsgID# , '%')
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchStartTime">
            A.BjobDmndMsgCretnHMS   BETWEEN  #searchStartTime# AND #searchEndTime#
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchBjobBzwkDstcd">
            A.BjobBzwkDstcd  LIKE  CONCAT( #searchBjobBzwkDstcd# , '%')
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchOsidInstiDstcd">
            A.OsidInstiDstcd  LIKE  CONCAT( #searchOsidInstiDstcd# , '%')
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchSndrcvFileName">
            B.SndrcvFileName LIKE  CONCAT( #searchSndrcvFileName# , '%')
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchProcessType">
             SUBSTR(A.BjobPtrnDstcd,2,1)  LIKE  CONCAT( #searchProcessType# , '%')
        </isNotEmpty>
        ORDER BY A.BjobDmndMsgCretnHMS DESC, A.TranStartHMS DESC, A.BjobDmndMsgID, A.BjobDmndSubMsgID
    </statement>

    <statement id="list_l" resultClass="java.util.HashMap">
         SELECT *
         FROM ( SELECT 
                        CASE WHEN BS05.SENDRECVYN is null OR BS05.SENDRECVYN  = '' THEN BJ08.SENDRECVYN ELSE BS05.SENDRECVYN END
                          AS SENDRECVYN         ,
                        CASE WHEN BS05.OSIDINSTIDSTCD is null OR BS05.OSIDINSTIDSTCD  = '' THEN BJ08.OSIDINSTIDSTCD ELSE BS05.OSIDINSTIDSTCD END
                          AS OSIDINSTIDSTCD     ,
                       CASE WHEN BS05.BJOBBZWKDSTCD is null OR BS05.BJOBBZWKDSTCD  = '' THEN BJ08.BJOBBZWKDSTCD ELSE BS05.BJOBBZWKDSTCD END
                          AS BJOBBZWKDSTCD      ,
                       CASE WHEN BS05.BJOBBZWKNAME is null OR BS05.BJOBBZWKNAME  = '' THEN BJ08.BJOBBZWKNAME ELSE BS05.BJOBBZWKNAME END
                          AS BJOBBZWKNAME       ,
                       CASE WHEN BS05.OSIDINSTINAME is null OR BS05.OSIDINSTINAME  = '' THEN BJ08.OSIDINSTINAME ELSE BS05.OSIDINSTINAME END
                          AS OSIDINSTINAME      ,
                       CASE WHEN BS05.BJOBTRANDSTCDNAME is null OR BS05.BJOBTRANDSTCDNAME  = '' THEN BJ08.BJOBTRANDSTCDNAME ELSE BS05.BJOBTRANDSTCDNAME END
                          AS BJOBTRANDSTCDNAME  ,
                       BS05.SNDRCVSTARTHMS                                     AS SNDRCVSTARTHMS     ,
                       BS05.SNDRCVENDHMS                                       AS SNDRCVENDHMS       ,
                       BS05.EAIWARNYN                                          AS EAIWARNYN          ,
                       BJ08.BJOBDMNDMSGID                                      AS BJOBDMNDMSGID      ,
                       BJ08.BJOBDMNDSUBMSGID                                   AS BJOBDMNDSUBMSGID   ,
                       BJ08.TRANPRCSSDSTCD                                     AS TRANPRCSSDSTCD     ,
                       BJ08.SNDRCVFILENAME                                     AS SNDRCVFILENAME     ,
                       BJ08.SNDRCVFILESIZE                                     AS SNDRCVFILESIZE     ,
                       BJ08.BJOBDMNDMSGCRETNHMS                                AS BJOBDMNDMSGCRETNHMS,
                       BJ08.TRANSTARTHMS                                       AS TRANSTARTHMS       ,
                       BJ08.TRANENDHMS                                         AS TRANENDHMS         ,
                       BS05.CURRENTTIME                                        AS CURRENTTIME        ,
                       $searchEndTime$                                         AS SEARCHSTART        ,
                       SUBSTR( DATE_FORMAT( NOW(3), '%Y%m%d%H%i%s%f'), 1, 17 )             AS CURRENTTIMESTAMP
                   FROM (  SELECT X.BjobMsgDstcd,
                                  Y.BjobBzwkDstcd,
                                  X.OsidInstiDstcd,
                                  X.SendRecvYn,
                                  RTRIM(X.SndrcvStartHMS)                      AS SndrcvStartHMS,
                                  RTRIM(X.SndrcvEndHMS)                        AS SndrcvEndHMS,
                                  X.EAIWarnYn,    
                                  Y.BjobBzwkName,
                                  Y.OsidInstiName,
                                  Y.BjobTranDstcdName,
                                  DATE_FORMAT( NOW(), '%H%i') AS CurrentTime
                          FROM $schemaId$.TSEAIBS05 X INNER JOIN
                                (SELECT P.BjobMsgDstcd,
                                    P.BjobBzwkDstcd,
                                    P.BjobTranDstcdName,
                                    S.BjobBzwkName,
                                    H.OsidInstiDstcd,
                                    H.OsidInstiName
                                FROM $schemaId$.TSEAIBJ01 P INNER JOIN $schemaId$.TSEAIBJ02 S ON P.BjobBzwkDstcd = S.BjobBzwkDstcd
                                    INNER JOIN $schemaId$.TSEAIBJ06 H ON P.BjobBzwkDstcd = H.BjobBzwkDstcd
                                ) Y on X.BjobMsgDstcd = Y.BjobMsgDstcd AND X.OsidInstiDstcd=Y.OsidInstiDstcd
                          WHERE X.ThisMsgUseYn = '1'
                          <isNotEmpty prepend="AND" property="searchBjobBzwkDstcd">
                                Y.BjobBzwkDstcd  LIKE  CONCAT( #searchBjobBzwkDstcd# , '%')
                          </isNotEmpty>
                          <isNotEmpty prepend="AND" property="searchOsidInstiDstcd">
                                X.OsidInstiDstcd  LIKE  CONCAT( #searchOsidInstiDstcd# , '%')
                          </isNotEmpty>
                          <isNotEmpty prepend="AND" property="searchProcessType">
                                X.SendRecvYn  LIKE  CONCAT( #searchProcessType# , '%')
                          </isNotEmpty>
                          <isNotEmpty prepend="AND" property="searchSndrcvFileName">
                                 Y.BjobTranDstcdName LIKE  CONCAT( #searchSndrcvFileName# , '%')
                          </isNotEmpty>
<!--                           <dynamic prepend="AND RTRIM(X.SndrcvCyclTypName) IN" open="(" close=")"> -->
<!--                                 <iterate property="basis" conjunction=", "> -->
<!--                                     #basis[]# -->
<!--                                </iterate> -->
<!--                           </dynamic> -->
                            AND DATE_FORMAT( NOW(), '%Y%m%d%H%i%s') &lt; (CONCAT(SUBSTR(CAST($searchEndHHMM$ AS CHAR),1,8) , CAST(X.SndrcvEndHMS AS CHAR))) 
                            )
                          ) BS05
                         LEFT OUTER JOIN (
                            SELECT A.BjobDmndMsgID,
                                    A.BjobDmndSubMsgID      ,
                                    A.BjobDmndMsgCretnHMS   ,
                                    A.BjobBzwkDstcd         ,
                                    C.BjobBzwkName          ,
                                    A.OsidInstiDstcd        ,
                                    D.OsidInstiName         ,
                                    SUBSTR(A.BjobPtrnDstcd,2,1) AS SendRecvYn,
                                    CASE WHEN B.TranStartHMS is null OR B.TranStartHMS  = '' THEN A.TranStartHMS ELSE B.TranStartHMS END
                                        AS TranStartHMS ,
                                    CASE WHEN B.TranEndHMS is null OR B.TranEndHMS  = '' THEN A.TranEndHMS ELSE B.TranEndHMS END
                                        AS TranEndHMS   ,
                                    B.BjobMsgDstcd                    ,
                                    CASE WHEN B.ThisStgePrcssRsultCd is null OR B.ThisStgePrcssRsultCd  = '' THEN A.TranPrcssDstcd ELSE B.ThisStgePrcssRsultCd END
                                        AS TranPrcssDstcd ,
                                    B.SndrcvFileName,
                                    B.SndrcvFileSize,
                                    B.BjobTranDstcdName                                    
                             FROM   $schemaId$.TSEAIBJ03 A LEFT OUTER JOIN
                                    (SELECT 
                                                F.BjobDmndMsgID,
                                                F.BjobDmndSubMsgID,
                                                E.BjobMsgDstcd,
                                                F.SndrcvFileName,
                                                F.SndrcvFileSize,
                                                E.BjobTranDstcdName,
                                                F.FileTrsmtStartHMS AS TranStartHMS,
                                                F.FileTrsmtEndHMS   AS TranEndHMS,
                                                F.ThisStgePrcssRsultCd    
                                        FROM $schemaId$.TSEAIBJ01 E JOIN $schemaId$.TSEAIBJ08 F ON E.bjobmsgdstcd=F.bjobmsgdstcd
                                        WHERE   F.ThisStgePrcssRsultCd = 'E' OR ThisStgePrcssRsultCd  = 'C'
                                        ) B ON A.BjobDmndMsgID = B.BjobDmndMsgID   AND A.BjobDmndSubMsgID = B.BjobDmndSubMsgID
                                                LEFT OUTER JOIN $schemaId$.TSEAIBJ02 C ON A.BjobBzwkDstcd = C.BjobBzwkDstcd
                                                LEFT OUTER JOIN $schemaId$.TSEAIBJ06 D ON A.BjobBzwkDstcd = D.BjobBzwkDstcd
                                        AND A.OsidInstiDstcd = D.OsidInstiDstcd
                            WHERE (TranPrcssDstcd  = 'E' OR TranPrcssDstcd  = 'C')
                    <isNotEmpty prepend="AND" property="searchBjobDmndMsgID">
                        A.BjobDmndMsgID LIKE  CONCAT( #searchBjobDmndMsgID# , '%')
                    </isNotEmpty>
                    <isNotEmpty prepend="AND" property="searchBbjobDmndSubMsgID">
                        A.BjobDmndSubMsgID  LIKE  CONCAT( #searchBbjobDmndSubMsgID# , '%')
                    </isNotEmpty>
                    <isNotEmpty prepend="AND" property="searchStartTime">
                        A.BjobDmndMsgCretnHMS   BETWEEN  #searchStartTime# AND #searchEndTime#
                    </isNotEmpty>
                    <isNotEmpty prepend="AND" property="searchBjobBzwkDstcd">
                        A.BjobBzwkDstcd  LIKE  CONCAT( #searchBjobBzwkDstcd# , '%')
                    </isNotEmpty>
                    <isNotEmpty prepend="AND" property="searchOsidInstiDstcd">
                        A.OsidInstiDstcd  LIKE  CONCAT( #searchOsidInstiDstcd# , '%')
                    </isNotEmpty>
                    <isNotEmpty prepend="AND" property="searchSndrcvFileName">
                         B.SndrcvFileName LIKE  CONCAT( #searchSndrcvFileName# , '%')
                    </isNotEmpty>
                    <isNotEmpty prepend="AND" property="searchProcessType">
                        SUBSTR(A.BjobPtrnDstcd,2,1)  LIKE  CONCAT( #searchProcessType# , '%')
                    </isNotEmpty>
            )BJ08 ON BS05.BjobMsgDstcd = BJ08.BjobMsgDstcd
                        AND BS05.SendRecvYn   = BJ08.SendRecvYn  ) A
            ORDER BY A.BjobDmndMsgCretnHMS DESC, A.TranStartHMS DESC, A.BjobDmndMsgID, A.BjobDmndSubMsgID
    </statement>
    <statement id="list_normal" resultClass="java.util.HashMap">
        SELECT A.BjobDmndMsgID AS BJOBDMNDMSGID,
               A.BjobDmndSubMsgID AS BJOBDMNDSUBMSGID     ,
               A.BjobDmndMsgCretnHMS AS BJOBDMNDMSGCRETNHMS  ,
               A.BjobBzwkDstcd AS BJOBBZWKDSTCD        ,
               C.BjobBzwkName AS BJOBBZWKNAME         ,
               A.OsidInstiDstcd AS OSIDINSTIDSTCD       ,
               D.OsidInstiName AS OSIDINSTINAME        ,
               SUBSTR(A.BjobPtrnDstcd,2,1) AS SENDRECVYN,
               CASE WHEN B.TranStartHMS is null OR B.TranStartHMS  = '' THEN  A.TranStartHMS ELSE B.TranStartHMS END AS TRANSTARTHMS ,
               CASE WHEN B.TranEndHMS is null OR B.TranEndHMS  = '' THEN  A.TranEndHMS ELSE B.TranEndHMS END AS TRANENDHMS   ,
               B.BjobMsgDstcd AS BJOBMSGDSTCD                   ,
               B.BjobMsgDstcdSeq AS BJOBMSGDSTCDSEQ     ,
               B.BaseYmd         AS BASEYMD,
               CASE WHEN B.ThisStgePrcssRsultCd is null OR B.ThisStgePrcssRsultCd  = '' THEN  A.TranPrcssDstcd ELSE B.ThisStgePrcssRsultCd END AS TRANPRCSSDSTCD ,
               B.SndrcvFileName AS SNDRCVFILENAME,
               B.SndrcvRecCnt AS SNDRCVRECCNT,
               B.SndrcvFileSize AS SNDRCVFILESIZE ,
               B.BjobTranDstcdName AS BJOBTRANDSTCDNAME
        FROM   $schemaId$.TSEAIBJ03 A LEFT OUTER JOIN
               ( SELECT F.BjobDmndMsgID,
                        F.BjobDmndSubMsgID,
                        E.BjobMsgDstcd,
                        F.BjobMsgDstcdSeq,
                        SUBSTR( F.BKUPSNDRCVFILENAME, LENGTH(F.BKUPSNDRCVFILENAME) - 11, 8 ) AS BaseYmd,
                        F.SndrcvFileName,
                        F.SndrcvRecCnt,
                        F.SndrcvFileSize,
                        E.BjobTranDstcdName,
                        F.ThisStgePrcssRsultCd,
                        F.FileTrsmtStartHMS AS TranStartHMS,
                        F.FileTrsmtEndHMS   AS TranEndHMS
                 FROM $schemaId$.TSEAIBJ01 E JOIN $schemaId$.TSEAIBJ08 F ON E.bjobmsgdstcd=F.bjobmsgdstcd
               ) B ON A.BjobDmndMsgID = B.BjobDmndMsgID  AND A.BjobDmndSubMsgID = B.BjobDmndSubMsgID
                       LEFT OUTER JOIN $schemaId$.TSEAIBJ02 C ON A.BjobBzwkDstcd = C.BjobBzwkDstcd
                       LEFT OUTER JOIN $schemaId$.TSEAIBJ06 D ON A.BjobBzwkDstcd = D.BjobBzwkDstcd
                                                             AND A.OsidInstiDstcd = D.OsidInstiDstcd
        <dynamic prepend="WHERE">
            <isNotEmpty prepend="AND" property="searchBjobDmndMsgID">
                A.BjobDmndMsgID LIKE  CONCAT( #searchBjobDmndMsgID# , '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchBbjobDmndSubMsgID">
                A.BjobDmndSubMsgID  LIKE  CONCAT( #searchBbjobDmndSubMsgID# , '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchStartTime">
                A.BjobDmndMsgCretnHMS   BETWEEN  #searchStartTime# AND #searchEndTime#
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="bjobBzwkDstcd">
                A.BjobBzwkDstcd  LIKE  CONCAT( #bjobBzwkDstcd# , '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="osidInstiDstcd">
                A.OsidInstiDstcd  LIKE  CONCAT( #osidInstiDstcd# , '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="sndrcvFileName">
                B.SndrcvFileName LIKE  CONCAT( #sndrcvFileName# , '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="bjobPtrnDstcd">
                SUBSTR(A.BjobPtrnDstcd,2,1)  LIKE CONCAT( #bjobPtrnDstcd# , '%')
            </isNotEmpty>
        </dynamic>
        <dynamic prepend="AND TranPrcssDstcd IN" open="(" close=")">
            <iterate property="tranPrcssDstcds" conjunction=", ">
                #tranPrcssDstcds[]#
            </iterate>
        </dynamic>
        <dynamic prepend="AND B.ThisStgePrcssRsultCd IN" open="(" close=")">
            <iterate property="tranPrcssDstcds2" conjunction=", ">
                #tranPrcssDstcds2[]#
            </iterate>
        </dynamic>
            ORDER BY A.BjobDmndMsgCretnHMS DESC, A.TranStartHMS DESC, A.BjobDmndMsgID, A.BjobDmndSubMsgID
    </statement>
    
    <statement id="list_f" resultClass="java.util.HashMap">
         SELECT *
         FROM ( SELECT   
                       CASE WHEN BS05.SENDRECVYN is null OR BS05.SENDRECVYN  = '' THEN BJ08.SENDRECVYN ELSE BS05.SENDRECVYN END
                          AS SENDRECVYN         ,
                       CASE WHEN BS05.OSIDINSTIDSTCD is null OR BS05.OSIDINSTIDSTCD  = '' THEN BJ08.OSIDINSTIDSTCD ELSE BS05.OSIDINSTIDSTCD END
                       AS OSIDINSTIDSTCD     ,
                       CASE WHEN BS05.BJOBBZWKDSTCD is null OR BS05.BJOBBZWKDSTCD  = '' THEN BJ08.BJOBBZWKDSTCD ELSE BS05.BJOBBZWKDSTCD END
                       AS BJOBBZWKDSTCD      ,
                       CASE WHEN BS05.BJOBBZWKNAME is null OR BS05.BJOBBZWKNAME  = '' THEN BJ08.BJOBBZWKNAME ELSE BS05.BJOBBZWKNAME END
                       AS BJOBBZWKNAME       ,
                       CASE WHEN BS05.OSIDINSTINAME is null OR BS05.OSIDINSTINAME  = '' THEN BJ08.OSIDINSTINAME ELSE BS05.OSIDINSTINAME END
                       AS OSIDINSTINAME      ,
                       CASE WHEN BS05.BJOBTRANDSTCDNAME is null OR BS05.BJOBTRANDSTCDNAME  = '' THEN BJ08.BJOBTRANDSTCDNAME ELSE BS05.BJOBTRANDSTCDNAME END
                       AS BJOBTRANDSTCDNAME  ,
                        BS05.SNDRCVSTARTHMS                                       AS SNDRCVSTARTHMS   ,
                        BS05.SNDRCVENDHMS                                         AS SNDRCVENDHMS     ,
                        BS05.EAIWARNYN                                            AS EAIWARNYN        ,
                        BJ08.BJOBDMNDMSGID                                        AS BJOBDMNDMSGID    ,
                        BJ08.BJOBDMNDSUBMSGID                                     AS BJOBDMNDSUBMSGID ,
                        IFNULL(BJ08.TRANPRCSSDSTCD , ' ')                            AS TRANPRCSSDSTCD,
                        BJ08.BJOBDMNDMSGCRETNHMS                                  AS BJOBDMNDMSGCRETNHMS,
                        BS05.CURRENTTIME                                          AS CURRENTTIME,
                        $searchEndHHMM$                                                AS SEARCHSTART,
                        SUBSTR( DATE_FORMAT( NOW(3), '%Y%m%d%H%i%s%f'), 1, 17 )  AS CURRENTTIMESTAMP,
                        CASE WHEN BS05.GROUPCOCD is null OR BS05.GROUPCOCD  = '' THEN BJ08.GROUPCOCD ELSE BS05.GROUPCOCD END
                               AS GROUPCOCD
                   FROM (  SELECT X.BjobMsgDstcd,
                                  Y.BjobBzwkDstcd,
                                  X.OsidInstiDstcd,
                                  X.SendRecvYn,
                                  RTRIM(X.SndrcvStartHMS)                         AS SndrcvStartHMS,
                                  RTRIM(X.SndrcvEndHMS)                           AS SndrcvEndHMS,
                                  X.EAIWarnYn,
                                  Y.BjobBzwkName,
                                  Y.OsidInstiName,
                                  Y.BjobTranDstcdName,
                                  DATE_FORMAT( NOW(), '%H%i')                         AS CurrentTime,
                                  IFNULL(Y.GroupCoCd, ' ' )                     AS GroupCoCd
                           FROM   $schemaId$.TSEAIBS05 X INNER JOIN
                                (SELECT P.BjobMsgDstcd,
                                        P.BjobBzwkDstcd,
                                        P.BjobTranDstcdName,
                                        S.BjobBzwkName,
                                        H.OsidInstiDstcd,
                                        H.OsidInstiName,
                                        P.GroupCoCd
                                 FROM   $schemaId$.TSEAIBJ01 P INNER JOIN $schemaId$.TSEAIBJ02 S ON P.BjobBzwkDstcd = S.BjobBzwkDstcd
                                                               INNER JOIN $schemaId$.TSEAIBJ06 H ON P.BjobBzwkDstcd = H.BjobBzwkDstcd
                                ) Y on X.BjobMsgDstcd = Y.BjobMsgDstcd AND X.OsidInstiDstcd=Y.OsidInstiDstcd
                          WHERE X.ThisMsgUseYn = '1'
                          <isNotEmpty prepend="AND" property="bjobBzwkDstcd">
                                Y.BjobBzwkDstcd  LIKE  CONCAT( #bjobBzwkDstcd#  ,  '%')
                          </isNotEmpty>
                          <isNotEmpty prepend="AND" property="osidInstiDstcd">
                                X.OsidInstiDstcd  LIKE  CONCAT( #osidInstiDstcd#  ,  '%')
                          </isNotEmpty>
                          <isNotEmpty prepend="AND" property="bjobPtrnDstcd">
                                X.SendRecvYn  LIKE  CONCAT( #bjobPtrnDstcd#  ,  '%')
                          </isNotEmpty>
                          <isNotEmpty prepend="AND" property="sndrcvFileName">
                                 Y.BjobTranDstcdName LIKE CONCAT( #sndrcvFileName#  ,  '%')
                          </isNotEmpty>
                          AND DATE_FORMAT( NOW(), '%Y%m%d%H%i%s') &lt;  (CONCAT(SUBSTR(CAST($searchEndHHMM$ AS CHAR),1,8) , CAST(X.SndrcvEndHMS AS CHAR)))
                         ) BS05
                         LEFT OUTER JOIN  (
                            SELECT A.BjobDmndMsgID,
                                   A.BjobDmndSubMsgID      ,
                                   A.BjobDmndMsgCretnHMS   ,
                                   A.BjobBzwkDstcd         ,
                                   C.BjobBzwkName          ,
                                   A.OsidInstiDstcd        ,
                                   D.OsidInstiName         ,
                                   SUBSTR(A.BjobPtrnDstcd,2,1) AS SendRecvYn,
                                   B.BjobMsgDstcd,
                                   B.BjobTranDstcdName                    ,
                                  CASE WHEN B.ThisStgePrcssRsultCd is null OR B.ThisStgePrcssRsultCd  = '' THEN A.TranPrcssDstcd ELSE B.ThisStgePrcssRsultCd END
                                       AS TranPrcssDstcd,
                                   B.GroupCoCd
                            FROM   $schemaId$.TSEAIBJ03 A LEFT OUTER JOIN
                                    (SELECT  
                                                F.BjobDmndMsgID,
                                                F.BjobDmndSubMsgID,
                                                E.BjobMsgDstcd,
                                                F.SndrcvFileName,
                                                F.SndrcvFileSize,
                                                E.BjobTranDstcdName,
                                                F.ThisStgePrcssRsultCd,
                                                F.FileTrsmtStartHMS AS TranStartHMS,
                                                F.FileTrsmtEndHMS   AS TranEndHMS,
                                                E.GroupCoCd
                                        FROM $schemaId$.TSEAIBJ01 E JOIN $schemaId$.TSEAIBJ08 F ON E.bjobmsgdstcd=F.bjobmsgdstcd
                                        ) B ON A.BjobDmndMsgID = B.BjobDmndMsgID   AND A.BjobDmndSubMsgID = B.BjobDmndSubMsgID
                                                LEFT OUTER JOIN $schemaId$.TSEAIBJ02 C ON A.BjobBzwkDstcd = C.BjobBzwkDstcd
                                                LEFT OUTER JOIN $schemaId$.TSEAIBJ06 D ON A.BjobBzwkDstcd = D.BjobBzwkDstcd
                                        AND A.OsidInstiDstcd = D.OsidInstiDstcd
                         <dynamic prepend="WHERE">
                            <isNotEmpty prepend="AND" property="bjobDmndMsgID">
                                A.BjobDmndMsgID LIKE CONCAT(#bjobDmndMsgID#  ,  '%')
                            </isNotEmpty>
                            <isNotEmpty prepend="AND" property="bjobDmndSubMsgID">
                                A.BjobDmndSubMsgID  LIKE CONCAT(#bjobDmndSubMsgID#  ,  '%')
                            </isNotEmpty>
                            <isNotEmpty prepend="AND" property="tanStartHMS">
                                A.BjobDmndMsgCretnHMS   BETWEEN  #tanStartHMS# AND #searchEndHHMM#
                            </isNotEmpty>
                            <isNotEmpty prepend="AND" property="searchBjobBzwkDstcd">
                                A.BjobBzwkDstcd  LIKE CONCAT(   #searchBjobBzwkDstcd#  ,  '%')
                            </isNotEmpty>
                            <isNotEmpty prepend="AND" property="searchOsidInstiDstcd">
                                A.OsidInstiDstcd  LIKE CONCAT(   #searchOsidInstiDstcd#  ,  '%')
                            </isNotEmpty>
                            <isNotEmpty prepend="AND" property="searchSndrcvFileName">
                                 B.SndrcvFileName LIKE CONCAT(   #searchSndrcvFileName#  ,  '%')
                            </isNotEmpty>
                            <isNotEmpty prepend="AND" property="searchProcessType">
                                SUBSTR(A.BjobPtrnDstcd,2,1)  LIKE CONCAT(   #searchProcessType#  ,  '%')
                            </isNotEmpty>
                        </dynamic>
            )BJ08 ON BS05.BjobMsgDstcd = BJ08.BjobMsgDstcd
                        AND BS05.SendRecvYn   = BJ08.SendRecvYn
            ) A
               WHERE  A.TranPrcssDstcd != 'T'
            <isNotEmpty prepend="AND" property="groupCoCd">
                A.GroupCoCd = #groupCoCd#
            </isNotEmpty>
            ORDER BY A.BjobDmndMsgCretnHMS DESC, A.SndrcvStartHMS DESC, A.BjobDmndMsgID, A.BjobDmndSubMsgID
    </statement>

    <statement id="speclist" resultClass="java.util.HashMap">
        SELECT /*+ JOIN_FIXED_ORDER() */ 
               A.BJOBDMNDMSGID
             , A.BJOBDMNDSUBMSGID
             , A.BJOBDMNDMSGCRETNHMS
             , A.BJOBBZWKDSTCD
             , A.OSIDINSTIDSTCD
             , C.BJOBBZWKNAME
             , SUBSTR(A.BJOBMSGSCHEID, 8, LENGTH(RTRIM(A.BJOBMSGSCHEID))-10) AS BJOBMSGSCHEID
             , D.OSIDINSTINAME AS OSIDINSTINAME
             , D.RQSTRSPNSDSTCD AS RQSTRSPNSDSTCD
             , SUBSTR(A.BJOBPTRNDSTCD, 2, 1) AS SENDRECVYN
             , A.TRANSTARTHMS AS TRANSTARTHMS 
             , A.TRANENDHMS AS TRANENDHMS
             , CASE WHEN SUBSTR(A.BJOBPTRNDSTCD, 2, 1) = 'S' THEN 
                    CASE WHEN B.FILECOPYSTARTHMS IS NULL OR B.FILECOPYSTARTHMS = '' THEN A.TRANSTARTHMS ELSE B.FILECOPYSTARTHMS END 
                    ELSE CASE WHEN B.FILETRSMTSTARTHMS IS NULL OR B.FILETRSMTSTARTHMS = '' THEN A.TRANSTARTHMS ELSE B.FILETRSMTSTARTHMS END
               END AS TRANSTARTHMS1
             , CASE WHEN SUBSTR(A.BJOBPTRNDSTCD, 2, 1) = 'S' THEN
                    CASE WHEN B.FILECOPYENDHMS IS NULL OR B.FILECOPYENDHMS = '' THEN A.TRANENDHMS ELSE B.FILECOPYENDHMS END
                    ELSE CASE WHEN B.FILETRSMTENDHMS IS NULL OR B.FILETRSMTENDHMS = '' THEN A.TRANENDHMS ELSE B.FILETRSMTENDHMS END 
               END AS TRANENDHMS1
             , CASE WHEN SUBSTR(A.BJOBPTRNDSTCD, 2, 1) = 'R' THEN B.FILECOPYSTARTHMS ELSE B.FILETRSMTSTARTHMS END AS TRANSTARTHMS2
             , CASE WHEN SUBSTR(A.BJOBPTRNDSTCD, 2, 1) = 'R' THEN B.FILECOPYENDHMS ELSE B.FILETRSMTENDHMS END AS TRANENDHMS2
             , B.BJOBMSGDSTCD AS BJOBMSGDSTCD
             , B.BJOBMSGDSTCDSEQ AS BJOBMSGDSTCDSEQ
             , SUBSTR( B.BKUPSNDRCVFILENAME, LENGTH(B.BKUPSNDRCVFILENAME) - 11, 8 ) AS BASEYMD
             , E.BJOBMSGDSTICNAME AS BJOBMSGDSTICNAME
             , E.BJOBTRANDSTCDNAME AS BJOBTRANDSTCDNAME
             , CASE WHEN B.THISSTGEPRCSSRSULTCD IS NULL OR B.THISSTGEPRCSSRSULTCD = '' THEN A.TRANPRCSSDSTCD ELSE B.THISSTGEPRCSSRSULTCD END AS TRANPRCSSDSTCD
             , B.SNDRCVFILENAME AS SNDRCVFILENAME
             , B.SNDRCVRECCNT AS SNDRCVRECCNT
             , B.SNDRCVFILESIZE AS SNDRCVFILESIZE, IFNULL(E.GROUPCOCD, ' ' ) AS GROUPCOCD
             , ' ' AS FILETRSMTLOGID
             , B.RQSTRECVFILESTORGDIRNAME 
             , B.BKUPSNDRCVFILENAME
             , A.EAISEVRINSTNCNAME
          FROM (
                  SELECT BJOBDMNDMSGID
                     , BJOBDMNDSUBMSGID
                     , BJOBDMNDMSGCRETNHMS
                     , BJOBBZWKDSTCD
                     , OSIDINSTIDSTCD
                     , BJOBMSGSCHEID
                     , TRANSTARTHMS
                     , TRANENDHMS
                     , BJOBPTRNDSTCD
                     , TRANPRCSSDSTCD
                     , EAISEVRINSTNCNAME
                  FROM $schemaId$.TSEAIBJ03
                  <dynamic prepend="WHERE">
                  	<isNotEmpty prepend="AND" property="searchStartTime">
                  		BjobDmndMsgCretnHMS BETWEEN #searchStartTime# AND #searchEndTime#
                  	</isNotEmpty>
                  </dynamic>
               ) A
          <!-- LEFT OUTER JOIN $schemaId$.TSEAIBJ08 B -->
          LEFT JOIN $schemaId$.TSEAIBJ08 B
            ON A.BJOBDMNDMSGID = B.BJOBDMNDMSGID
           AND A.BJOBDMNDSUBMSGID = B.BJOBDMNDSUBMSGID
          LEFT JOIN $schemaId$.TSEAIBJ01 E
            ON E.BJOBMSGDSTCD = B.BJOBMSGDSTCD
          LEFT JOIN $schemaId$.TSEAIBJ02 C 
            ON A.BJOBBZWKDSTCD = C.BJOBBZWKDSTCD
          LEFT JOIN ( SELECT D1.BJOBBZWKDSTCD,
                                           D1.OSIDINSTIDSTCD,
                                           D1.OSIDINSTINAME, 
                                           MIN(D2.RQSTRSPNSDSTCD) as RQSTRSPNSDSTCD 
                             FROM $schemaId$.TSEAIBJ06 D1 
                             LEFT JOIN $schemaId$.TSEAIBJ05 D2 ON D1.BJOBBZWKDSTCD = D2.BJOBBZWKDSTCD
                                                                                     and D1.OSIDINSTIDSTCD = D2.OSIDINSTIDSTCD
                             GROUP BY D1.BJOBBZWKDSTCD, D1.OSIDINSTIDSTCD, D1.OSIDINSTINAME ) D 
            ON A.BJOBBZWKDSTCD = D.BJOBBZWKDSTCD
           AND A.OSIDINSTIDSTCD = D.OSIDINSTIDSTCD
        <dynamic prepend="WHERE">
            <isNotEmpty prepend="AND" property="searchStartTime">
                A.BjobDmndMsgCretnHMS BETWEEN #searchStartTime# AND #searchEndTime#
            </isNotEmpty>
            <isEqual prepend="AND" property="searchStatus" compareValue="A">
                IFNULL(B.ThisStgePrcssRsultCd, A.TranPrcssDstcd) != 'N'
            </isEqual>
            <isNotEqual prepend="AND" property="searchStatus" compareValue="A">
                IFNULL(B.ThisStgePrcssRsultCd, A.TranPrcssDstcd) = #searchStatus#
            </isNotEqual>
            <isNotEmpty prepend="AND" property="searchBjobDmndMsgID">
                A.BjobDmndMsgID LIKE  CONCAT(#searchBjobDmndMsgID#, '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchBbjobDmndSubMsgID">
                A.BjobDmndSubMsgID LIKE CONCAT(#searchBbjobDmndSubMsgID#, '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchBjobBzwkDstcd">
                A.BjobBzwkDstcd LIKE CONCAT(#searchBjobBzwkDstcd#, '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchOsidInstiDstcd">
                A.OsidInstiDstcd LIKE CONCAT(#searchOsidInstiDstcd#, '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchSndrcvFileName">
                B.SndrcvFileName LIKE CONCAT(#searchSndrcvFileName#, '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchProcessType">
                SUBSTR(A.BjobPtrnDstcd, 2, 1) = #searchProcessType#
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchBjobMsgDstcd">
                B.BJOBMSGDSTCD LIKE CONCAT(#searchBjobMsgDstcd#, '%')
            </isNotEmpty>
            
        </dynamic>
         ORDER BY A.BJOBDMNDMSGCRETNHMS DESC, A.TRANSTARTHMS DESC, TRANSTARTHMS1 DESC, A.BJOBDMNDMSGID, A.BJOBDMNDSUBMSGID
    </statement>
    
    <statement id="masterlog" resultClass="java.util.HashMap">
         SELECT A.BJOBDMNDMSGID         ,
                A.BJOBDMNDSUBMSGID      ,
                A.TELGMRETRALCNT        ,
                A.BJOBMSGSCHEID         ,
                A.BJOBDMNDMSGCRETNHMS   ,
                A.BJOBBZWKDSTCD         ,
                C.BJOBBZWKNAME          ,
                A.OSIDINSTIDSTCD        ,
                D.OSIDINSTINAME         ,
                A.BJOBPTRNDSTCD         ,
                A.MSGSNDRID             ,
                A.MSGSNDRNAME           ,
                A.SYSLNKGDSTCD          ,
                A.LNKGIPINFONAME        ,
                A.FLOWRULECD            ,
                A.EAISEVRINSTNCNAME     ,
                A.TRANSTARTHMS          ,
                A.TRANENDHMS            ,
                A.TRANPRCSSDSTCD
        FROM    $schemaId$.TSEAIBJ03 A LEFT OUTER JOIN $schemaId$.TSEAIBJ02 C ON A.BjobBzwkDstcd = C.BjobBzwkDstcd
                                       LEFT OUTER JOIN $schemaId$.TSEAIBJ06 D ON A.BjobBzwkDstcd = D.BjobBzwkDstcd AND A.OsidInstiDstcd = D.OsidInstiDstcd
        WHERE   A.BjobDmndMsgID     = #bjobDmndMsgID#
        AND     A.BjobDmndSubMsgID  = #bjobDmndSubMsgID#
    </statement>

    <statement id="getFileLogCount" resultClass="java.lang.Integer">
        SELECT 
                 COUNT(*) AS stageTotalCount
         FROM   $schemaId$.TSEAIBJ08 B LEFT OUTER JOIN $schemaId$.TSEAIBJ01 E ON   B.bjobmsgdstcd     = E.bjobmsgdstcd
         WHERE  B.BjobDmndMsgID     = #bjobDmndMsgID#
         AND    B.BjobDmndSubMsgID  = #bjobDmndSubMsgID#
    </statement>
    
    <statement id="filelog" resultClass="java.util.HashMap">
        SELECT * FROM 
            (SELECT @NO := @NO + 1 AS ROWNO, t1.*
                FROM (
			         SELECT B.BJOBDMNDMSGID           ,
			                B.BJOBDMNDSUBMSGID        ,
			                E.BJOBMSGDSTCD            ,
			                E.BJOBMSGDSTICNAME        ,
			                B.BJOBTRANDSTCDNAME       ,
			                B.RQSTRECVFILESTORGDIRNAME,
			                B.SNDRCVFILENAME          ,
			                B.BKUPSNDRCVFILENAME      ,
			                B.SNDRCVRECCNT            ,
			                B.SNDRCVFILESIZE          ,
			                B.FILETRSMTSTARTHMS       ,
			                B.FILETRSMTENDHMS         ,
			                B.THISSTGEPRCSSRSULTCD    ,
			                B.EAIOBSTCLOCCURCAUSCTNT  ,
			                B.BJOBFILEHDRCTNT         ,
			                B.BJOBFILETRAILCTNT       ,
			                E.UAPPLCD                 ,
			                E.THISMSGCHRGIDS          ,
			                B.HDRINFONAME
			         FROM   $schemaId$.TSEAIBJ08 B LEFT OUTER JOIN $schemaId$.TSEAIBJ01 E ON   B.bjobmsgdstcd     = E.bjobmsgdstcd
			         WHERE  B.BjobDmndMsgID     = #bjobDmndMsgID#
			         AND    B.BjobDmndSubMsgID  = #bjobDmndSubMsgID#
			         ORDER BY B.BjobDmndMsgID, B.BjobDmndSubMsgID, B.FileTrsmtStartHMS
                ) t1, (SELECT @NO := 0) R
            ) S
            WHERE ROWNO BETWEEN #startNum# AND #endNum#
    </statement>
    
    <statement id="getStageLogCount" resultClass="java.lang.Integer">
        SELECT 
                 COUNT(*) AS stageTotalCount
         FROM  $schemaId$.TSEAIBJ04 B LEFT OUTER JOIN $schemaId$.TSEAIBR04 C ON B.BjobRuleCd        = C.BjobBzwkPrcssDstcd
                                                  LEFT OUTER JOIN $schemaId$.TSEAIBR02 D ON B.BjobRuleCd        = D.BjobBzwkPrcssDstcd
                                                                                        AND B.BjobStgeSerno     = D.BjobStgeSerno
                                                  LEFT OUTER JOIN $schemaId$.TSEAIBJ01 E ON B.bjobmsgdstcd     = E.bjobmsgdstcd
                     WHERE  B.BjobDmndMsgID     = #bjobDmndMsgID#
                     AND    B.BjobDmndSubMsgID  = #bjobDmndSubMsgID#
    </statement>

    <statement id="stagelog" resultClass="java.util.HashMap">
        SELECT * FROM 
            (SELECT @NO := @NO + 1 AS ROWNO, t1.*
                FROM (
                     SELECT B.BJOBDMNDMSGID            ,
                             B.BJOBDMNDSUBMSGID        ,
                             B.BJOBSTGEID              ,
                             B.PRCSSSTGEDSTCD          ,
                             B.BJOBRULECD              ,
                             C.FLOWRULEPTRNDESC        ,
                             B.BJOBSTGECD              ,
                             D.BJOBSTGEFLXBLCNDNDESC   ,
                             B.BJOBSTGESERNO           ,
                             B.BJOBSTGEPTRNNAME        ,
                             B.BJOBFLOWCMPOCLSNAME     ,
                             B.TELGMDCSNID             ,
                             B.TELGMDCSNCLSNAME        ,
                             B.TELGMDCSNMSGCD          ,
                             B.THISSTGETELGMID         ,
                             B.THISSTGECLSNAME         ,
                             B.THISSTGEMSGCD           ,
                             B.TELGMPERTYPCDVALCTNT    ,
                             B.TELGMDSTCDVALCTNT       ,
                             B.TELGMMGTCDVALCTNT       ,
                             B.RSPNSCDVALCTNT          ,
                             B.BJOBNODECASNO           ,
                             B.BJOBMSGDSTCD            ,
                             E.BJOBMSGDSTICNAME        ,
                             B.BJOBTRANDSTCDNAME       ,
                             B.RQSTRECVFILESTORGDIRNAME,
                             B.SNDRCVFILENAME          ,
                             B.BKUPSNDRCVFILENAME      ,
                             B.THISSTGESTARTHMS        ,
                             B.THISSTGEENDHMS          ,
                             B.THISSTGEPRCSSRSULTCD    ,
                             B.EAIOBSTCLOCCURCAUSCTNT  ,
                             B.BJOBTELGMHDR            ,
                             B.BJOBTELGMTBODY
                     FROM  $schemaId$.TSEAIBJ04 B LEFT OUTER JOIN $schemaId$.TSEAIBR04 C ON B.BjobRuleCd        = C.BjobBzwkPrcssDstcd
                                                  LEFT OUTER JOIN $schemaId$.TSEAIBR02 D ON B.BjobRuleCd        = D.BjobBzwkPrcssDstcd
                                                                                        AND B.BjobStgeSerno     = D.BjobStgeSerno
                                                  LEFT OUTER JOIN $schemaId$.TSEAIBJ01 E ON B.bjobmsgdstcd     = E.bjobmsgdstcd
                     WHERE  B.BjobDmndMsgID     = #bjobDmndMsgID#
                     AND    B.BjobDmndSubMsgID  = #bjobDmndSubMsgID#
                     ORDER BY B.BjobDmndMsgID, B.BjobDmndSubMsgID, B.ThisStgeStartHMS,  B.BjobNodeCasNo
                ) t1, (SELECT @NO := 0) R
            ) S
            WHERE ROWNO BETWEEN #startNum# AND #endNum#
    </statement>
            
    <statement id="count" resultClass="java.lang.Integer">
         SELECT     COUNT(BjobDmndMsgID) AS TotalCount
            FROM ( SELECT A.BjobDmndMsgID 
                     FROM   $schemaId$.TSEAIBJ03 A LEFT OUTER JOIN $schemaId$.TSEAIBJ08 B ON A.BjobDmndMsgID    = B.BjobDmndMsgID
                                                                                         AND A.BjobDmndSubMsgID = B.BjobDmndSubMsgID
                                                   LEFT OUTER JOIN $schemaId$.TSEAIBJ02 C ON A.BjobBzwkDstcd    = C.BjobBzwkDstcd
                                                   LEFT OUTER JOIN $schemaId$.TSEAIBJ06 D ON A.BjobBzwkDstcd    = D.BjobBzwkDstcd
                                                                                         AND A.OsidInstiDstcd   = D.OsidInstiDstcd
        <dynamic prepend="WHERE">
            <isNotEmpty prepend="AND" property="bjobDmndMsgID">
                A.BjobDmndMsgID LIKE CONCAT(  #bjobDmndMsgID# , '%' )
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="bjobDmndSubMsgID">
                A.BjobDmndSubMsgID  LIKE CONCAT(  #bjobDmndSubMsgID# , '%' )
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="tanStartHMS">
                A.BjobDmndMsgCretnHMS   BETWEEN  #tanStartHMS# AND #searchEndHHMM#
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="bjobBzwkDstcd">
                A.BjobBzwkDstcd  LIKE CONCAT(  #bjobBzwkDstcd# , '%' )
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="osidInstiDstcd">
                A.OsidInstiDstcd  LIKE CONCAT(  #osidInstiDstcd# , '%' )
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="bjobPtrnDstcd">
                SUBSTR(A.BjobPtrnDstcd,2,1) LIKE CONCAT(  #bjobPtrnDstcd# , '%' )
            </isNotEmpty>
            <isEqual prepend="AND" property="tranPrcssDstcd" compareValue="A">
                IFNULL( B.ThisStgePrcssRsultCd , A.TranPrcssDstcd" ) != 'N'
            </isEqual>
            <isNotEqual prepend="AND" property="tranPrcssDstcd" compareValue="A">
                IFNULL( B.ThisStgePrcssRsultCd , A.TranPrcssDstcd ) LIKE  #tranPrcssDstcd#
            </isNotEqual>
            <isNotEmpty prepend="AND" property="sndrcvFileName">
                 B.SndrcvFileName LIKE CONCAT(  #sndrcvFileName# , '%' )
            </isNotEmpty>
        </dynamic>
            ORDER BY A.BjobDmndMsgCretnHMS DESC, A.BjobDmndMsgID, A.BjobDmndSubMsgID
            ) TMP    
    </statement>    

    <statement id="selectOsidInstiDstcd" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
         SELECT DISTINCT 
                OsidInstiDstcd AS CODE,
                OsidInstiName AS NAME
         FROM $schemaId$.TSEAIBJ06
         WHERE ThisMsgUseYn = '1'
         <isNotEmpty prepend="AND" property="bjobBzwkDstcd">
                BjobBzwkDstcd = #bjobBzwkDstcd#
        </isNotEmpty>
         ORDER BY NAME
    </statement>

	<statement id="updateStatusChangeMaster" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		UPDATE $schemaId$.TSEAIBJ03 
		   SET TranPrcssDstcd = #statusType#
		 WHERE BjobDmndMsgID        = #bjobDmndMsgID#
		   AND BjobDmndSubMsgID     = #bjobDmndSubMsgID#
	</statement>

	<statement id="updateStatusChange" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		UPDATE $schemaId$.TSEAIBJ08 
		   SET ThisStgePrcssRsultCd = #statusType#
		 WHERE BjobDmndMsgID        = #bjobDmndMsgID#
		   AND BjobDmndSubMsgID     = #bjobDmndSubMsgID#
		   AND SndRcvFileName       = #sndRcvFileName#
	</statement>

    <statement id="selectCippSendLog" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
         SELECT BjobMsgDstcd,
                SUBSTR(FileTrsmtEndHMS, 1, 14 ) AS SendDateTime
         FROM $schemaId$.TSEAIBJ08
         WHERE ThisStgePrcssRsultCd  = 'T'
         AND FileTrsmtEndHMS LIKE CONCAT( #fileTrsmtEndHMS#, '%' )
         AND BjobMsgDstcd IN (
                 SELECT Prpty2Val
                 FROM $schemaId$.TSEAIBP02
                 WHERE PrptyGroupName = 'CIPP'
                 AND PrptyName LIKE 'FL_%'
             )
         ORDER BY SUBSTR(FileTrsmtEndHMS, 1, 14 )
    </statement>

</sqlMap>