package kr.co.udapsoft.ebid.buyer.test.biz;

import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.WAFSQLException;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;

public class FileMigrationRunMain {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		
	}
	
	
	
	
	/**
	 * 계약 별 첨부파일 목록 ( SGC이앤씨 첨부로 구분 )
	 * @return
	 */
	private RowSet getContFileList(String db_link_nm, String project_no){
		RowSet rowSet = new RowSetImpl();
		Search search = new SearchImpl();
		StringBuffer sqlStr = new StringBuffer();
		
		try {
			
			
			sqlStr.append("SELECT  FILE_LIST.FILE_ID            AS FILE_ID           --첨부문서ID     \n");
			sqlStr.append("       ,FILE_LIST.UNIQUE_FILE_NAME   AS REAL_FILE_NAME    --고유파일명     \n");
			sqlStr.append("       ,FILE_LIST.FILE_PATH          AS FILE_PATH         --파일경로       \n");
			sqlStr.append("       ,FILE_LIST.FILE_EXT           AS FILE_EXT          --파일종류       \n");
			sqlStr.append("       ,FILE_LIST.FILE_SIZE          AS FILE_SIZE         --파일크기       \n");
			sqlStr.append("       ,FILE_LIST.FILE_NAME          AS FILE_NAME         --파일명         \n");
			sqlStr.append("       ,'PUR_CONT_MOD_ID'            AS FILE_GB           --파일 구분      \n");
			sqlStr.append("       ,CONT_MOD.PUR_CONT_MOD_ID        AS ID                --발주계약ID     \n");
			sqlStr.append("       ,'PUR_CONT_MOD_ID'            AS O_FILE_GB           --파일 구분      \n");
			sqlStr.append("       ,CONT_MOD.PUR_CONT_MOD_ID        AS O_ID                --발주계약ID     \n");
			sqlStr.append("       ,FILE_LIST.CRE_BY                                  --등록자         \n");
			sqlStr.append("       ,FILE_LIST.CRE_DATE                                --등록일시       \n");
			sqlStr.append("       ,FILE_LIST.UPD_BY                                  --수정자         \n");
			sqlStr.append("       ,FILE_LIST.UPD_DATE                                --수정일시       \n");
			sqlStr.append("       ,CONT.PUR_CONT_ID                                  --계약번호       \n");
			sqlStr.append("       ,'/cont/purchase/' || CONT_MOD.PUR_CONT_MOD_ID AS NEW_PATH                         --신규등록 될 디렉토리      \n");
			sqlStr.append("       ,'N' as MAP_YN                                     --file map 정보 여부       \n");
			sqlStr.append("       ,'N' as OPEN_CORP_YN                                  --file map 정보 여부       \n");
			sqlStr.append("       ,'Y' as USE_CON_YN                                  --file map 정보 여부       \n");
			sqlStr.append("       ,'F' as ADD_GB                                     --file map 정보 여부       \n");
			sqlStr.append("FROM PUR1000T"+db_link_nm+" CONT,                                                        \n");
			sqlStr.append("      ( SELECT PUR_CONT_ID, MAX(PUR_CONT_MOD_ID) AS PUR_CONT_MOD_ID   \n");
			sqlStr.append("          FROM PUR2000T"+db_link_nm+"                                                           \n");
			sqlStr.append("          WHERE CON_RUN_STS = '9'                                                           \n");
			sqlStr.append("        GROUP BY PUR_CONT_ID                                             \n");
			sqlStr.append("       ) CONT_MOD,                                                  \n");
			sqlStr.append("        (                                                                  \n");
			sqlStr.append("            SELECT  A.FILE_ID                                              \n");
			sqlStr.append("                   ,A.UNIQUE_FILE_NAME                                     \n");
			sqlStr.append("                   ,A.FILE_PATH                                            \n");
			sqlStr.append("                   ,A.FILE_EXT                                             \n");
			sqlStr.append("                   ,A.FILE_SIZE                                            \n");
			sqlStr.append("                   ,A.FILE_NAME                                            \n");
			sqlStr.append("                   ,'PUR_CONT_MOD_ID'                                      \n");
			sqlStr.append("                   ,A.PUR_CONT_ID                                          \n");
			sqlStr.append("                   ,A.CRE_BY                                               \n");
			sqlStr.append("                   ,A.CRE_DATE                                             \n");
			sqlStr.append("                   ,A.UPD_BY                                               \n");
			sqlStr.append("                   ,A.UPD_DATE                                             \n");
			sqlStr.append("             FROM  PUR1001T"+db_link_nm+" A                                              \n");
			sqlStr.append("            UNION ALL                                                      \n");
			sqlStr.append("            SELECT  A.FILE_ID                                              \n");
			sqlStr.append("                   ,A.UNIQUE_FILE_NAME                                     \n");
			sqlStr.append("                   ,A.FILE_PATH                                            \n");
			sqlStr.append("                   ,A.FILE_EXT                                             \n");
			sqlStr.append("                   ,A.FILE_SIZE                                            \n");
			sqlStr.append("                   ,A.FILE_NAME                                            \n");
			sqlStr.append("                   ,'PUR_CONT_MOD_ID'  AS FILE_GB                          \n");
			sqlStr.append("                   ,A.PUR_CONT_ID        AS ID                             \n");
			sqlStr.append("                   ,A.CRE_BY                                               \n");
			sqlStr.append("                   ,A.CRE_DATE                                             \n");
			sqlStr.append("                   ,A.UPD_BY                                               \n");
			sqlStr.append("                   ,A.UPD_DATE                                             \n");
			sqlStr.append("             FROM  PUR1002T"+db_link_nm+" A                                              \n");
			sqlStr.append("            where (file_name like '%계약%' or file_name like '%발주%')     \n");
			sqlStr.append("            and file_name not like '%이행%'                                \n");
			sqlStr.append("            and file_name not like '%보증%'                                \n");
			sqlStr.append("            and file_name not like '%증권%'                                \n");
			sqlStr.append(" )FILE_LIST                                                                \n");
			sqlStr.append(" WHERE CONT.PUR_CONT_ID = FILE_LIST.PUR_CONT_ID                            \n");
			sqlStr.append("  AND CONT.PUR_CONT_ID = CONT_MOD.PUR_CONT_ID                           \n");
			sqlStr.append("  AND CONT.DEPT_CD = ?                                                \n");
			sqlStr.append(" ORDER BY PUR_CONT_ID ASC                                          \n");

			
			search.setStatement(sqlStr.toString());
			search.addParameter(project_no);
        
        	rowSet = search.execute();
		}catch (WAFSQLException se) {
           System.out.println("===================================");
           System.out.println("Error : getContFileList : "+ se.getMessage());
           System.out.println("===================================");
           
        }
		
		return rowSet;
	}

	/**
	 * 계약 별 보증 첨부파일 목록 ( 업체 첨부로 구분 )
	 * @return
	 */
	private RowSet getContGuarFileList(String db_link_nm, String project_no){
		RowSet rowSet = new RowSetImpl();
		Search search = new SearchImpl();
		StringBuffer sqlStr = new StringBuffer();
		
		try {
			
			sqlStr.append(" SELECT  FILE_LIST.FILE_ID            AS FILE_ID                       --첨부문서ID                                                              \n");
			sqlStr.append("        ,FILE_LIST.UNIQUE_FILE_NAME   AS REAL_FILE_NAME                --고유파일명                                                              \n");
			sqlStr.append("        ,FILE_LIST.FILE_PATH          AS FILE_PATH                     --파일경로                                                                \n");
			sqlStr.append("        ,FILE_LIST.FILE_EXT           AS FILE_EXT                      --파일종류                                                                \n");
			sqlStr.append("        ,FILE_LIST.FILE_SIZE          AS FILE_SIZE                     --파일크기                                                                \n");
			sqlStr.append("        ,FILE_LIST.FILE_NAME          AS FILE_NAME                     --파일명                                                                  \n");
			sqlStr.append("        ,'GUARCONT_PUR_1_1'            AS FILE_GB                       --파일 구분                                                               \n");
			sqlStr.append("        ,FILE_LIST.PUR_CONT_ID        AS ID                            --발주계약ID                                                              \n");
			sqlStr.append("        ,'GUARCONT_PUR_1_1'            AS O_FILE_GB                     --파일 구분                                                               \n");
			sqlStr.append("        ,FILE_LIST.PUR_CONT_ID        AS O_ID                          --발주계약ID                                                              \n");
			sqlStr.append("        ,FILE_LIST.CRE_BY                                              --등록자                                                                  \n");
			sqlStr.append("        ,FILE_LIST.CRE_DATE                                            --등록일시                                                                \n");
			sqlStr.append("        ,FILE_LIST.UPD_BY                                              --수정자                                                                  \n");
			sqlStr.append("        ,FILE_LIST.UPD_DATE                                            --수정일시                                                                \n");
			sqlStr.append("        ,CONT.PUR_CONT_ID                                              --계약번호                                                                \n");
			sqlStr.append("        ,'/cont/purchase/guar/' || CONT_MOD.PUR_CONT_MOD_ID AS NEW_PATH     --신규등록될디렉토리                                                 \n");
			sqlStr.append("        ,'N' as MAP_YN                                                 --file map 정보 여부                                                      \n");
			sqlStr.append("        ,'N' as OPEN_CORP_YN                                           --file map 정보 여부                                                      \n");
			sqlStr.append("        ,'Y' as USE_CON_YN                                             --file map 정보 여부                                                      \n");
			sqlStr.append("        ,'F' as ADD_GB                                                 --file map 정보 여부                                                      \n");
			sqlStr.append(" FROM PUR1000T"+db_link_nm+" CONT,                                                                                                                             \n");
			sqlStr.append("       ( SELECT PUR_CONT_ID, MAX(PUR_CONT_MOD_ID) AS PUR_CONT_MOD_ID                                                                             \n");
			sqlStr.append("           FROM PUR2000T"+db_link_nm+"                                                                                                                         \n");
			sqlStr.append("           WHERE CON_RUN_STS = '9'                                                                                                                     \n");
			sqlStr.append("         GROUP BY PUR_CONT_ID                                                                                                                    \n");
			sqlStr.append("        ) CONT_MOD,                                                                                                                              \n");
			sqlStr.append("       (                                                                                                                                         \n");
			sqlStr.append("             select *                                                                                                                            \n");
			sqlStr.append("             from PUR1002T"+db_link_nm+"                                                                                                                       \n");
			sqlStr.append("             where  (file_name like '%이행%' or file_name like '%증권%' or     file_name like '%보증%' OR upper(file_name) like '%BOND%')        \n");
			sqlStr.append("             and file_name not like '%선급%'                                                                                                     \n");
			sqlStr.append("             and file_name not like '%선금금%'                                                                                                   \n");
			sqlStr.append("             and file_name not like '%선금급%'                                                                                                   \n");
			sqlStr.append("             union                                                                                                                               \n");
			sqlStr.append("             select *                                                                                                                            \n");
			sqlStr.append("             from (                                                                                                                              \n");
			sqlStr.append("                 select *                                                                                                                        \n");
			sqlStr.append("                 from PUR1002T"+db_link_nm+"                                                                                                                   \n");
			sqlStr.append("                 where (file_name like '%계약이행%' or file_name like '%계약 이행%')                                                             \n");
			sqlStr.append("                 minus                                                                                                                           \n");
			sqlStr.append("                 select *                                                                                                                        \n");
			sqlStr.append("                 from PUR1002T"+db_link_nm+"                                                                                                                   \n");
			sqlStr.append("                 where  (file_name like '%이행%' or file_name like '%증권%' or     file_name like '%보증%' OR upper(file_name) like '%BOND%')    \n");
			sqlStr.append("                 and file_name not like '%선급%'                                                                                                 \n");
			sqlStr.append("                 and file_name not like '%선금금%'                                                                                               \n");
			sqlStr.append("                 and file_name not like '%선금급%'                                                                                               \n");
			sqlStr.append("             )                                                                                                                                   \n");
			sqlStr.append("         )FILE_LIST                                                                                                                              \n");
			sqlStr.append("    WHERE CONT.PUR_CONT_ID = FILE_LIST.PUR_CONT_ID                                                                                               \n");
			sqlStr.append("     AND CONT.PUR_CONT_ID = CONT_MOD.PUR_CONT_ID                                                                                              \n");
			sqlStr.append("     AND CONT.DEPT_CD = ?                                                                                                                   \n");
			sqlStr.append("     ORDER BY PUR_CONT_ID ASC                                                                                                                    \n");

			
			
			search.setStatement(sqlStr.toString());
			search.addParameter(project_no);
			
			rowSet = search.execute();
		}catch (WAFSQLException se) {
	           System.out.println("===================================");
	           System.out.println("Error : getContGuarFileList : "+ se.getMessage());
	           System.out.println("===================================");
		}
		
		return rowSet;
	}
	/**
	 * 계약 별 선급 보증 첨부파일 목록 ( 업체 첨부로 구분 )
	 * @return
	 */
	private RowSet getContPrePayGuarFileList(String db_link_nm, String project_no){
		RowSet rowSet = new RowSetImpl();
		Search search = new SearchImpl();
		StringBuffer sqlStr = new StringBuffer();
		
		try {
			
			sqlStr.append(" SELECT  FILE_LIST.FILE_ID            AS FILE_ID                       --첨부문서ID                                                              \n");
			sqlStr.append("        ,FILE_LIST.UNIQUE_FILE_NAME   AS REAL_FILE_NAME                --고유파일명                                                              \n");
			sqlStr.append("        ,FILE_LIST.FILE_PATH          AS FILE_PATH                     --파일경로                                                                \n");
			sqlStr.append("        ,FILE_LIST.FILE_EXT           AS FILE_EXT                      --파일종류                                                                \n");
			sqlStr.append("        ,FILE_LIST.FILE_SIZE          AS FILE_SIZE                     --파일크기                                                                \n");
			sqlStr.append("        ,FILE_LIST.FILE_NAME          AS FILE_NAME                     --파일명                                                                  \n");
			sqlStr.append("        ,'GUARCONT_PUR_3_1'            AS FILE_GB                      --파일 구분                                                               \n");
			sqlStr.append("        ,PRE_PAY.PREPAY_ID              AS ID                          --선급내역ID                                                              \n");
			sqlStr.append("        ,'GUARCONT_PUR_3_1'            AS O_FILE_GB                    --파일 구분                                                               \n");
			sqlStr.append("        ,PRE_PAY.PREPAY_ID              AS O_ID                        --선급내역ID                                                            \n");
			sqlStr.append("        ,FILE_LIST.CRE_BY                                              --등록자                                                                  \n");
			sqlStr.append("        ,FILE_LIST.CRE_DATE                                            --등록일시                                                                \n");
			sqlStr.append("        ,FILE_LIST.UPD_BY                                              --수정자                                                                  \n");
			sqlStr.append("        ,FILE_LIST.UPD_DATE                                            --수정일시                                                                \n");
			sqlStr.append("        ,CONT.PUR_CONT_ID                                              --계약번호                                                                \n");
			sqlStr.append("        ,'/cont/purchase/guar/' || CONT_MOD.PUR_CONT_MOD_ID AS NEW_PATH     --신규등록될디렉토리                                                 \n");
			sqlStr.append("        ,'N' as MAP_YN                                                 --file map 정보 여부                                                      \n");
			sqlStr.append("        ,'N' as OPEN_CORP_YN                                           --file map 정보 여부                                                      \n");
			sqlStr.append("        ,'Y' as USE_CON_YN                                             --file map 정보 여부                                                      \n");
			sqlStr.append("        ,'F' as ADD_GB                                                 --file map 정보 여부                                                      \n");
			sqlStr.append(" FROM PUR1000T"+db_link_nm+" CONT, PUR2000T"+db_link_nm+" CONT_MOD, PUR1030T PRE_PAY,                                                                                                                             \n");
			sqlStr.append("       (                                                                                                                                         \n");
			sqlStr.append("             select *                                                                                                                            \n");
			sqlStr.append("             from PUR1002T"+db_link_nm+"                                                                                                                       \n");
			sqlStr.append("             where  (file_name like '%선급%' or file_name like '%선금%')        \n");
			sqlStr.append("             and file_name not like '%포기%'                                                                                                     \n");
			sqlStr.append("         )FILE_LIST                                                                                                                              \n");
			sqlStr.append("    WHERE PRE_PAY.PUR_CONT_ID = FILE_LIST.PUR_CONT_ID                                                                                                \n");
			sqlStr.append("      AND PRE_PAY.PUR_CONT_ID = CONT.PUR_CONT_ID                                                                                         \n");
			sqlStr.append("      AND PRE_PAY.PUR_CONT_ID = CONT_MOD.PUR_CONT_ID                                                                                        \n");
			sqlStr.append("      AND PRE_PAY.PUR_CONT_MOD_ID = CONT_MOD.PUR_CONT_MOD_ID                                                                                      \n");
			sqlStr.append("      AND CONT.DEPT_CD = ?                                                                                                                   \n");
			sqlStr.append("     ORDER BY PUR_CONT_ID ASC                                                                                                                    \n");
			
			
			
			search.setStatement(sqlStr.toString());
			search.addParameter(project_no);
			
			rowSet = search.execute();
		}catch (WAFSQLException se) {
	           System.out.println("===================================");
	           System.out.println("Error : getContPrePayGuarFileList : "+ se.getMessage());
	           System.out.println("===================================");
		}
		
		return rowSet;
	}
	/**
	 * 계약 별 선급 보증 첨부파일 목록 ( 업체 첨부로 구분 )
	 * @return
	 */
	private RowSet getContPrePayGivUpGuarFileList(String db_link_nm, String project_no){
		RowSet rowSet = new RowSetImpl();
		Search search = new SearchImpl();
		StringBuffer sqlStr = new StringBuffer();
		
		try {
			
			sqlStr.append("  SELECT  FILE_LIST.FILE_ID            AS FILE_ID                       --첨부문서ID                    \n");
			sqlStr.append("         ,FILE_LIST.UNIQUE_FILE_NAME   AS REAL_FILE_NAME                --고유파일명                    \n");
			sqlStr.append("         ,FILE_LIST.FILE_PATH          AS FILE_PATH                     --파일경로                      \n");
			sqlStr.append("         ,FILE_LIST.FILE_EXT           AS FILE_EXT                      --파일종류                      \n");
			sqlStr.append("         ,FILE_LIST.FILE_SIZE          AS FILE_SIZE                     --파일크기                      \n");
			sqlStr.append("         ,FILE_LIST.FILE_NAME          AS FILE_NAME                     --파일명                        \n");
			sqlStr.append("         ,'PUR_CONT_MOD_ID'            AS FILE_GB                      --파일 구분                      \n");
			sqlStr.append("         ,CONT_MOD.PUR_CONT_MOD_ID              AS ID                          --선급내역ID             \n");
			sqlStr.append("         ,'PUR_CONT_MOD_ID'            AS O_FILE_GB                    --파일 구분                      \n");
			sqlStr.append("         ,CONT_MOD.PUR_CONT_MOD_ID              AS O_ID                        --선급내역ID             \n");
			sqlStr.append("         ,FILE_LIST.CRE_BY                                              --등록자                        \n");
			sqlStr.append("         ,FILE_LIST.CRE_DATE                                            --등록일시                      \n");
			sqlStr.append("         ,FILE_LIST.UPD_BY                                              --수정자                        \n");
			sqlStr.append("         ,FILE_LIST.UPD_DATE                                            --수정일시                      \n");
			sqlStr.append("         ,CONT.PUR_CONT_ID                                              --계약번호                      \n");
			sqlStr.append("         ,'/prepay/purchase/' || CONT_MOD.PUR_CONT_MOD_ID AS NEW_PATH     --신규등록될디렉토리          \n");
			sqlStr.append("         ,'N' as MAP_YN                                                 --file map 정보 여부            \n");
			sqlStr.append("         ,'N' as OPEN_CORP_YN                                           --file map 정보 여부            \n");
			sqlStr.append("         ,'Y' as USE_CON_YN                                             --file map 정보 여부            \n");
			sqlStr.append("         ,'F' as ADD_GB                                                 --file map 정보 여부            \n");
			sqlStr.append("  FROM PUR1000T"+db_link_nm+" CONT,                                                                                   \n");
			sqlStr.append("        ( SELECT PUR_CONT_ID, MAX(PUR_CONT_MOD_ID) AS PUR_CONT_MOD_ID                                   \n");
			sqlStr.append("            FROM PUR2000T"+db_link_nm+"                                                                               \n");
			sqlStr.append("            GROUP BY PUR_CONT_ID                                                                        \n");
			sqlStr.append("        ) CONT_MOD,                                                                                     \n");
			sqlStr.append("        (     select *                                                                                  \n");
			sqlStr.append("              from PUR1002T"+db_link_nm+"                                                                             \n");
			sqlStr.append("              where  (file_name like '%선급%' or file_name like '%선금%')                               \n");
			sqlStr.append("              and file_name like '%포기%'                                                               \n");
			sqlStr.append("          )FILE_LIST                                                                                    \n");
			sqlStr.append("     WHERE CONT.PUR_CONT_ID = FILE_LIST.PUR_CONT_ID                                                     \n");
			sqlStr.append("       AND CONT.PUR_CONT_ID = CONT_MOD.PUR_CONT_ID                                                      \n");
			sqlStr.append("       AND CONT.DEPT_CD = ?                                                                             \n");
			sqlStr.append("      ORDER BY PUR_CONT_ID ASC                                                                          \n");
			
			
			
			search.setStatement(sqlStr.toString());
			search.addParameter(project_no);
			
			rowSet = search.execute();
		}catch (WAFSQLException se) {
	           System.out.println("===================================");
	           System.out.println("Error : getContPrePayGuarFileList : "+ se.getMessage());
	           System.out.println("===================================");
		}
		
		return rowSet;
	}

	

	/**
	 * 외주 계약 별 첨부파일 목록 
	 * @return
	 */
	private RowSet getContOutFileList(String db_link_nm, String project_no){
		RowSet rowSet = new RowSetImpl();
		Search search = new SearchImpl();
		StringBuffer sqlStr = new StringBuffer();
		
		try {
			
			
			sqlStr.append("SELECT  A.FILE_ID                                 --FILE_ID                 \n");
			sqlStr.append("       ,A.REAL_FILE_NAME                          --실제파일명              \n");
			sqlStr.append("       ,A.FILE_NAME                               --파일이름                \n");
			sqlStr.append("       ,A.FILE_ROUTE             AS FILE_PATH                 --파일경로    \n");
			sqlStr.append("       ,A.FILE_EXPAN             AS FILE_EXT                 --확장자       \n");
			sqlStr.append("       ,A.FILE_SIZE                               --파일크기                \n");
			sqlStr.append("       ,A.MINE_TYPE                               --MINE_TYPE               \n");
			sqlStr.append("       ,A.CONTENT_TYPE                            --CONTENT_TYPE            \n");
			sqlStr.append("       ,A.CONTENT_DISP                            --CONTENT_DISP            \n");
			sqlStr.append("       ,A.SUB_MINE_TYPE                           --SUB_MINE_TYPE           \n");
			sqlStr.append("       ,'SUB_CONT_MOD_ID'  AS O_FILE_GB                                     \n");
			sqlStr.append("       ,B.FILE_CONN_ID            AS  O_ID                                  \n");
			sqlStr.append("       ,'SUB_CONT_MOD_ID'  AS FILE_GB                                       \n");
			sqlStr.append("       ,B.FILE_CONN_ID            AS  ID                                    \n");
			sqlStr.append("       ,'/cont/outside/' || CONT.SUB_CONT_MOD_ID AS NEW_PATH                \n");
			sqlStr.append("       ,A.CRE_BY                                  --등록자                  \n");
			sqlStr.append("       ,A.CRE_DATE                                --등록일시                \n");
			sqlStr.append("       ,A.UPD_BY                                  --수정자                  \n");
			sqlStr.append("       ,A.UPD_DATE                                --수정일시                \n");
			sqlStr.append("       ,'N' as MAP_YN                                     --file map 정보 여부       \n");
			sqlStr.append("       ,'N' as OPEN_CORP_YN                                  --file map 정보 여부       \n");
			sqlStr.append("       ,'Y' as USE_CON_YN                                  --file map 정보 여부       \n");
			sqlStr.append("       ,'F' as ADD_GB                                     --file map 정보 여부       \n");
			sqlStr.append(" FROM  COM102T"+db_link_nm+" A, COM101T"+db_link_nm+" B,                                                \n");
			sqlStr.append("         ( SELECT MAX(SUB_CONT_MOD_ID)  AS SUB_CONT_MOD_ID, A.SUB_CONT_ID, A.DEPT_CD   \n");
			sqlStr.append("            FROM SUB1000T"+db_link_nm+" A, SUB2000T"+db_link_nm+" B                                     \n");
			sqlStr.append("            WHERE A.SUB_CONT_ID = B.SUB_CONT_ID                             \n");
			sqlStr.append("            GROUP BY A.SUB_CONT_ID, A.DEPT_CD                                          \n");
			sqlStr.append("         ) CONT                                                             \n");
			sqlStr.append("WHERE A.FILE_MAP_ID = B.FILE_MAP_ID                                         \n");
			sqlStr.append("AND B.FILE_CONN_ID = CONT.SUB_CONT_ID                                       \n");
			sqlStr.append("AND B.FILE_CONN_CLASS = 'SUB1000T'                                          \n");
			sqlStr.append("AND CONT.DEPT_CD = ?                                                \n");
			sqlStr.append("ORDER BY B.FILE_MAP_ID ASC                                                  \n");
			
			
			search.setStatement(sqlStr.toString());
			search.addParameter(project_no);
        
        	rowSet = search.execute();
		}catch (WAFSQLException se) {
	           System.out.println("===================================");
	           System.out.println("Error : getContOutFileList : "+ se.getMessage());
	           System.out.println("===================================");
        }
		
		return rowSet;
	}
}
