@Override public ArrayList<Recipe> findRecipsbyWindowId(int windowid) throws Exception { // 窗口的所有菜系名称和菜的平均分 ArrayList<Recipe> recipes = new ArrayList<Recipe>(); String sql = "select recipeid,windowid,dishname,averagedishscore from recipe where windowid=? order by averagedishscore desc"; this.pstmt = this.conn.prepareStatement(sql); this.pstmt.setInt(1, windowid); ResultSet rs = this.pstmt.executeQuery(); while (rs.next()) { Recipe temprecipe = new Recipe(); temprecipe.setRecipeId(rs.getInt(1)); temprecipe.setWindowId(rs.getInt(2)); temprecipe.setDishname(rs.getString(3)); temprecipe.setAverageDishScore(rs.getDouble(4)); recipes.add(temprecipe); } return recipes; }