Example #1
0
  /**
   * 指定した年月のデータを全て取得する
   *
   * @param uSid ユーザーSID
   * @param frDate from日付
   * @param toDate to日付
   * @return List in Tcd010Model 結果を格納したListオブジェクト
   * @throws SQLException SQL実行例外
   */
  public HashMap<String, Tcd010Model> getTimeCardMap(int uSid, UDate frDate, UDate toDate)
      throws SQLException {
    // 休日関連追加済み
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    Connection con = null;
    HashMap<String, Tcd010Model> ret = new HashMap<String, Tcd010Model>();
    con = getCon();

    try {
      // SQL文
      SqlBuffer sql = new SqlBuffer();
      sql.addSql(" select ");
      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(" from ");
      sql.addSql("   TCD_TCDATA");
      sql.addSql(" where ");
      sql.addSql("   USR_SID = ?");
      sql.addSql(" and ");
      sql.addSql("   TCD_DATE >= ?");
      sql.addSql(" and");
      sql.addSql("   TCD_DATE <= ?");
      sql.addSql(" order by");
      sql.addSql("   TCD_DATE");

      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addIntValue(uSid);
      sql.addDateValue(frDate);
      sql.addDateValue(toDate);

      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      rs = pstmt.executeQuery();
      Tcd010Model model = null;
      while (rs.next()) {
        model = __getTcd010FromRs(rs);
        ret.put(model.getTcdDate().getDateString(), model);
      }
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeResultSet(rs);
      JDBCUtil.closeStatement(pstmt);
    }

    return ret;
  }
Example #2
0
  /**
   * Create TCD_TCDATA Data Bindding JavaBean From ResultSet
   *
   * @param rs ResultSet
   * @return created Tcd010Model
   * @throws SQLException SQL実行例外
   */
  private Tcd010Model __getTcd010FromRs(ResultSet rs) throws SQLException {
    Tcd010Model bean = new Tcd010Model();
    bean.setUsrSid(rs.getInt("USR_SID"));
    bean.setTcdDate(UDate.getInstanceTimestamp(rs.getTimestamp("TCD_DATE")));
    bean.setTcdIntime(rs.getTime("TCD_INTIME"));
    bean.setTcdOuttime(rs.getTime("TCD_OUTTIME"));
    bean.setTcdStrikeIntime(rs.getTime("TCD_STRIKE_INTIME"));
    bean.setTcdStrikeOuttime(rs.getTime("TCD_STRIKE_OUTTIME"));
    bean.setTcdBiko(rs.getString("TCD_BIKO"));
    bean.setTcdStatus(rs.getInt("TCD_STATUS"));
    bean.setTcdHolkbn(rs.getInt("TCD_HOLKBN"));
    bean.setTcdHolother(rs.getString("TCD_HOLOTHER"));
    bean.setTcdHolcnt(rs.getBigDecimal("TCD_HOLCNT"));
    bean.setTcdChkkbn(rs.getInt("TCD_CHKKBN"));
    bean.setTcdSoukbn(rs.getInt("TCD_SOUKBN"));
    bean.setTcdLockFlg(rs.getInt("TCD_LOCK_FLG"));
    bean.setTcdAuid(rs.getInt("TCD_AUID"));
    bean.setTcdAdate(UDate.getInstanceTimestamp(rs.getTimestamp("TCD_ADATE")));
    bean.setTcdEuid(rs.getInt("TCD_EUID"));
    bean.setTcdEdate(UDate.getInstanceTimestamp(rs.getTimestamp("TCD_EDATE")));

    return bean;
  }