/** 2015-11-6 段彬彬 首次创建 查询油耗明细 */ public ArrayList<Oil> queryOil(Context context, String beginTime, String endTime) { ArrayList<Oil> list = new ArrayList<Oil>(); Oil oil = null; dbr = DBHelper.getDBHelper(context).getReadableDatabase(); Cursor cursor = dbr.rawQuery( "select litre,cost,kilo,systime,id from oil where systime between ? and ? ORDER BY id DESC", new String[] {beginTime, endTime}); while (cursor.moveToNext()) { oil = new Oil(); double litre = cursor.getDouble(0); int cost = cursor.getInt(1); int kilo = cursor.getInt(2); String systime = cursor.getString(3); int id = cursor.getInt(4); oil.setLitre(litre); oil.setKilo(kilo); oil.setCost(cost); oil.setSystime(systime); oil.setId(id); list.add(oil); } cursor.close(); dbr.close(); return list; }