Exemplo n.º 1
0
 @Override
 public List<CoreTeam> findCoreTeamList() {
   String sql = "select * from t_coreteam";
   Connection conn = null;
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   List<CoreTeam> coreteamlist = new ArrayList<CoreTeam>();
   try {
     conn = this.getConnection();
     pstmt = conn.prepareStatement(sql);
     rs = pstmt.executeQuery();
     while (rs.next()) {
       CoreTeam coreteam = new CoreTeam();
       coreteam.setId(rs.getInt("id"));
       coreteam.setCoreTeaminfo(rs.getString("coreteaminfo"));
       coreteamlist.add(coreteam);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     this.closeAll(conn, null, rs, pstmt);
   }
   return coreteamlist;
 }
Exemplo n.º 2
0
 @Override
 public CoreTeam findCoreTeamById(int id) {
   String sql = "select * from t_coreteam where id=?";
   Connection conn = null;
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   CoreTeam coreteam = null;
   try {
     conn = this.getConnection();
     pstmt = conn.prepareStatement(sql);
     pstmt.setObject(1, id);
     rs = pstmt.executeQuery();
     if (rs.next()) {
       coreteam = new CoreTeam();
       coreteam.setId(rs.getInt("id"));
       coreteam.setCoreTeaminfo(rs.getString("coreteaminfo"));
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     this.closeAll(conn, null, rs, pstmt);
   }
   return coreteam;
 }