@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; }
@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; }
@Override public int updateCoreTeam(CoreTeam coreTeam) { String sql = "update t_coreteam set coreteaminfo=? where id=?"; Object[] param = {coreTeam.getCoreTeaminfo(), coreTeam.getId()}; return exceuteUpdate(sql, param); }
@Override public int addCoreTeam(CoreTeam coreTeam) { String sql = "insert into t_coreteam (coreteaminfo)values(?)"; Object[] param = {coreTeam.getCoreTeaminfo()}; return exceuteUpdate(sql, param); }