@SuppressWarnings("unchecked") public List<helloWordDto> getCardUpgradeDetailList( String cardUpgradeId) { String sql = "SELECT hello_id FROM helloword WHERE word = ?"; try{ return (List<helloWordDto>)this.getJdbcTemplate().query(sql, new Object[]{cardUpgradeId}, new RowMapper() { public CardUpgradeDetailDto mapRow(ResultSet rs, int arg1) throws SQLException { helloWordDto dto = new helloWordDto(); dto.sethelloId(rs.getString("hello_id")); return dto; } }); }catch(Exception e){ logger.error("執行sql:"+sql+";錯誤",e); return null; } }
@SuppressWarnings("unchecked") public List<helloword> getSendhellowordList(final String helloid){ List<helloword> list1 = (List<helloword>)getJdbcTemplate().execute(new StatementCallback(){ public Object doInStatement(Statement stm) throws SQLException,DataAccessException { String sql = "select helloid,helloNAME from helloword helloid = "+ helloid ; ResultSet rs = stm.executeQuery(sql); List<helloword> list = null; while(rs.next()){ if(null == list){ list = new ArrayList<helloword>(); } helloword s = new helloword(); String hellowordId = rs.getString("helloid"); String hellowordName = rs.getString("helloNAME"); s.sethellowordId(hellowordId); s.sethellowordName(hellowordName); list.add(s); } return list; } }); return list1; }