/*********************************************************************************************************
 * 프로그램명 : DataDupCheck.java 프로그램설명 : 테이블의 데이타가 있는지 유무 체크 class 작성자 : 작성일 : 2016.04.25
 **********************************************************************************************************/

package kr.co.kihyun.beans.totsys.doc.table;

import java.sql.*;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import kr.co.kihyun.db.*;


public class DataDupCheck extends DBManager {
      
      private static final Logger LOG = LoggerFactory.getLogger(DataDupCheck.class);

      private ResultSet rs = null;


      //MOUMI_ACPT_LIMIT_STRATEGY 테이블 데이타 유무 체크
      public boolean getChk_MOUMI_ACPT_LIMIT_STRATEGY(Long id)
      {
	  String sql="";
	  try
          {
                sql="select id from MOUMI_ACPT_LIMIT_STRATEGY where id=?";
                rs=execQuery(sql,id);
                if (rs.next()) return true;
                else return false;
	   }
           catch(SQLException sqlEx)
           {
                LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
                    new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
                throw new RuntimeException(sqlEx);
	   }
           catch(Exception ex) { throw new RuntimeException(ex); }
           finally { close(rs); execClose(); }
	}
      
      //MOUMI_BOARD 테이블 데이타 유무 체크
      public boolean getChk_MOUMI_BOARD(Long id)
      {
	  String sql="";
	  try
          {
                sql="select id from MOUMI_BOARD where id=?";
                rs=execQuery(sql,id);
                if (rs.next()) return true;
                else return false;
	   }
           catch(SQLException sqlEx)
           {
                LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
                    new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
                throw new RuntimeException(sqlEx);
	   }
           catch(Exception ex) { throw new RuntimeException(ex); }
           finally { close(rs); execClose(); }
	}
      
      //MOUMI_TOT_DOC 테이블 데이타 유무 체크
      public boolean getChk_MOUMI_TOT_DOC(Long id)
      {
	  String sql="";
	  try
          {
                sql="select id from MOUMI_TOT_DOC where id=?";
                rs=execQuery(sql,id);
                if (rs.next()) return true;
                else return false;
	   }
           catch(SQLException sqlEx)
           {
                LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
                    new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
                throw new RuntimeException(sqlEx);
	   }
           catch(Exception ex) { throw new RuntimeException(ex); }
           finally { close(rs); execClose(); }
      }

            //MOUMI_TOT_ITEM 테이블 데이타 유무 체크
      public boolean getChk_MOUMI_TOT_ITEM(Long id)
      {
	  String sql="";
	  try
          {
                sql="select id from MOUMI_TOT_ITEM where id=?";
                rs=execQuery(sql,id);
                if (rs.next()) return true;
                else return false;
	   }
           catch(SQLException sqlEx)
           {
                LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
                    new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
                throw new RuntimeException(sqlEx);
	   }
           catch(Exception ex) { throw new RuntimeException(ex); }
           finally { close(rs); execClose(); }
      }
      
      //MOUMI_TOT_REPORT 테이블 데이타 유무 체크
      public boolean getChk_MOUMI_TOT_REPORT(Long id)
      {
	  String sql="";
	  try
          {
                sql="select id from MOUMI_TOT_REPORT where id=?";
                rs=execQuery(sql,id);
                if (rs.next()) return true;
                else return false;
	   }
           catch(SQLException sqlEx)
           {
                LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
                    new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
                throw new RuntimeException(sqlEx);
	   }
           catch(Exception ex) { throw new RuntimeException(ex); }
           finally { close(rs); execClose(); }
      }
      
      //MOUMI_TOT_TABLE 테이블 데이타 유무 체크
      public boolean getChk_MOUMI_TOT_TABLE(Long id)
      {
	  String sql="";
	  try
          {
                sql="select id from MOUMI_TOT_TABLE where id=?";
                rs=execQuery(sql,id);
                if (rs.next()) return true;
                else return false;
	   }
           catch(SQLException sqlEx)
           {
                LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
                    new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql });
                throw new RuntimeException(sqlEx);
	   }
           catch(Exception ex) { throw new RuntimeException(ex); }
           finally { close(rs); execClose(); }
	}
      

      
      
}
