コード例 #1
0
 @Override
 public List<TalentIdea> findAllTalentIdea() {
   String sql = "select * from t_talentidea";
   Connection conn = null;
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   List<TalentIdea> talentIdeaList = new ArrayList<TalentIdea>();
   try {
     conn = this.getConnection();
     pstmt = conn.prepareStatement(sql);
     rs = pstmt.executeQuery();
     while (rs.next()) {
       TalentIdea talentIdea = new TalentIdea();
       talentIdea.setId(rs.getInt("id"));
       talentIdea.setTalentideainfo(rs.getString("talentideainfo"));
       talentIdeaList.add(talentIdea);
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     this.closeAll(conn, null, rs, pstmt);
   }
   return talentIdeaList;
 }
コード例 #2
0
 @Override
 public TalentIdea findTalentIdeaById(int id) {
   String sql = "select * from t_talentidea where id=?";
   Connection conn = null;
   PreparedStatement pstmt = null;
   ResultSet rs = null;
   TalentIdea talentIdea = null;
   try {
     conn = this.getConnection();
     pstmt = conn.prepareStatement(sql);
     pstmt.setObject(1, id);
     rs = pstmt.executeQuery();
     if (rs.next()) {
       talentIdea = new TalentIdea();
       talentIdea.setId(rs.getInt("id"));
       talentIdea.setTalentideainfo(rs.getString("talentideainfo"));
     }
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     this.closeAll(conn, null, rs, pstmt);
   }
   return talentIdea;
 }
コード例 #3
0
 @Override
 public int updateTalentIdea(TalentIdea talentIdea) {
   String sql = "update t_talentidea set talentideainfo=? where id=?";
   Object[] param = {talentIdea.getTalentideainfo(), talentIdea.getId()};
   return exceuteUpdate(sql, param);
 }
コード例 #4
0
 @Override
 public int addTalentIdea(TalentIdea talentIdea) {
   String sql = "insert into t_talentidea (talentideainfo)values(?)";
   Object[] param = {talentIdea.getTalentideainfo()};
   return exceuteUpdate(sql, param);
 }