コード例 #1
0
ファイル: TcdTcdataDao.java プロジェクト: tmtkkwgch/hellogit
  /**
   * Update TCD_TCDATA Data Bindding JavaBean
   *
   * @param bean TCD_TCDATA Data Bindding JavaBean
   * @return int 更新件数
   * @throws SQLException SQL実行例外
   */
  public int update(TcdTcdataModel bean) throws SQLException {

    PreparedStatement pstmt = null;
    int count = 0;
    Connection con = null;
    con = getCon();

    try {
      // SQL文
      SqlBuffer sql = new SqlBuffer();
      sql.addSql(" update");
      sql.addSql("   TCD_TCDATA");
      sql.addSql(" set ");
      sql.addSql("   TCD_INTIME=?,");
      sql.addSql("   TCD_OUTTIME=?,");
      sql.addSql("   TCD_STRIKE_INTIME=?,");
      sql.addSql("   TCD_STRIKE_OUTTIME=?,");
      sql.addSql("   TCD_BIKO=?,");
      sql.addSql("   TCD_STATUS=?,");
      sql.addSql("   TCD_HOLKBN=?,");
      sql.addSql("   TCD_HOLOTHER=?,");
      sql.addSql("   TCD_HOLCNT=?,");
      sql.addSql("   TCD_CHKKBN=?,");
      sql.addSql("   TCD_SOUKBN=?,");
      sql.addSql("   TCD_LOCK_FLG=?,");
      sql.addSql("   TCD_EUID=?,");
      sql.addSql("   TCD_EDATE=?");
      sql.addSql(" where ");
      sql.addSql("   USR_SID=?");
      sql.addSql(" and");
      sql.addSql("   TCD_DATE=?");

      pstmt = con.prepareStatement(sql.toSqlString());
      if (bean.getTcdIntime() != null) {
        sql.addDateValue(UDate.getInstance(bean.getTcdIntime().getTime()));
      } else {
        sql.addDateValue((UDate) null);
      }

      if (bean.getTcdOuttime() != null) {
        sql.addDateValue(UDate.getInstance(bean.getTcdOuttime().getTime()));
      } else {
        sql.addDateValue((UDate) null);
      }

      if (bean.getTcdStrikeIntime() != null) {
        sql.addDateValue(UDate.getInstance(bean.getTcdStrikeIntime().getTime()));
      } else {
        sql.addDateValue((UDate) null);
      }

      if (bean.getTcdStrikeOuttime() != null) {
        sql.addDateValue(UDate.getInstance(bean.getTcdStrikeOuttime().getTime()));
      } else {
        sql.addDateValue((UDate) null);
      }

      sql.addStrValue(bean.getTcdBiko());
      sql.addIntValue(bean.getTcdStatus());
      sql.addIntValue(bean.getTcdHolkbn());
      sql.addStrValue(bean.getTcdHolother());
      sql.addDecimalValue(bean.getTcdHolcnt());
      sql.addIntValue(bean.getTcdChkkbn());
      sql.addIntValue(bean.getTcdSoukbn());
      sql.addIntValue(bean.getTcdLockFlg());
      sql.addIntValue(bean.getTcdEuid());
      sql.addDateValue(bean.getTcdEdate());
      // where
      sql.addIntValue(bean.getUsrSid());
      sql.addDateValue(bean.getTcdDate());

      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      count = pstmt.executeUpdate();
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
    return count;
  }
コード例 #2
0
ファイル: TcdTcdataDao.java プロジェクト: tmtkkwgch/hellogit
  /**
   * Insert TCD_TCDATA Data Bindding JavaBean
   *
   * @param bean TCD_TCDATA Data Bindding JavaBean
   * @throws SQLException SQL実行例外
   */
  public void insert(TcdTcdataModel bean) throws SQLException {

    PreparedStatement pstmt = null;
    Connection con = null;
    con = getCon();

    try {
      // SQL文
      SqlBuffer sql = new SqlBuffer();
      sql.addSql(" insert ");
      sql.addSql(" into ");
      sql.addSql(" TCD_TCDATA(");
      sql.addSql("   USR_SID,");
      sql.addSql("   TCD_DATE,");
      sql.addSql("   TCD_INTIME,");
      sql.addSql("   TCD_OUTTIME,");
      sql.addSql("   TCD_STRIKE_INTIME,");
      sql.addSql("   TCD_STRIKE_OUTTIME,");
      sql.addSql("   TCD_BIKO,");
      sql.addSql("   TCD_STATUS,");
      sql.addSql("   TCD_HOLKBN,");
      sql.addSql("   TCD_HOLOTHER,");
      sql.addSql("   TCD_HOLCNT,");
      sql.addSql("   TCD_CHKKBN,");
      sql.addSql("   TCD_SOUKBN,");
      sql.addSql("   TCD_LOCK_FLG,");
      sql.addSql("   TCD_AUID,");
      sql.addSql("   TCD_ADATE,");
      sql.addSql("   TCD_EUID,");
      sql.addSql("   TCD_EDATE");
      sql.addSql(" )");
      sql.addSql(" values");
      sql.addSql(" (");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   cast(? as time),");
      sql.addSql("   cast(? as time),");
      sql.addSql("   cast(? as time),");
      sql.addSql("   cast(? as time),");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?");
      sql.addSql(" )");

      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addIntValue(bean.getUsrSid());
      sql.addDateValue(bean.getTcdDate());
      if (null != bean.getTcdIntime()) {
        sql.addStrValue(bean.getTcdIntime().toString()); // Time型をhh:mm:ss形式に
      } else {
        sql.addDateValue((UDate) null);
      }

      if (null != bean.getTcdOuttime()) {
        sql.addStrValue(bean.getTcdOuttime().toString()); // 同上
      } else {
        sql.addDateValue((UDate) null);
      }

      if (null != bean.getTcdStrikeIntime()) {
        sql.addStrValue(bean.getTcdStrikeIntime().toString()); // 同上
      } else {
        sql.addDateValue((UDate) null);
      }

      if (null != bean.getTcdStrikeOuttime()) {
        sql.addStrValue(bean.getTcdStrikeOuttime().toString()); // 同上
      } else {
        sql.addDateValue((UDate) null);
      }

      if (null != bean.getTcdBiko()) {
        sql.addStrValue(bean.getTcdBiko());
      } else {
        sql.addStrValue((String) null);
      }
      sql.addIntValue(bean.getTcdStatus());
      sql.addIntValue(bean.getTcdHolkbn());
      sql.addStrValue(bean.getTcdHolother());
      sql.addDecimalValue(bean.getTcdHolcnt());
      sql.addIntValue(bean.getTcdChkkbn());
      sql.addIntValue(bean.getTcdSoukbn());
      sql.addIntValue(bean.getTcdLockFlg());
      sql.addIntValue(bean.getTcdAuid());
      sql.addDateValue(bean.getTcdAdate());
      sql.addIntValue(bean.getTcdEuid());
      sql.addDateValue(bean.getTcdEdate());
      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      pstmt.executeUpdate();
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
  }