/** * 根据产品组合编号查询产品组合主表记录 * * @param pgCode 产品组合编号 * @return */ public ProductGroupHeadData getProductGroupHeadByCode(String pgCode) { SQLiteDatabase db = AssetsDatabaseManager.getManager().getDatabase(); Cursor c = db.rawQuery( "SELECT PG1_ID,PG1_CU1_ID,PG1_CODE,PG1_Name FROM ProductGroupHead WHERE PG1_CODE=? limit 1", new String[] {pgCode}); ProductGroupHeadData productGroupHead = null; while (c.moveToNext()) { productGroupHead = new ProductGroupHeadData(); productGroupHead.setPg1Id(c.getString(c.getColumnIndex("PG1_ID"))); productGroupHead.setPg1Cu1Id(c.getString(c.getColumnIndex("PG1_CU1_ID"))); productGroupHead.setPg1Code(c.getString(c.getColumnIndex("PG1_CODE"))); productGroupHead.setPg1Name(c.getString(c.getColumnIndex("PG1_Name"))); break; } return productGroupHead; }
/** * 查询所有产品组合主表记录 * * @return */ public List<ProductGroupHeadData> findAllProductGroupHead() { List<ProductGroupHeadData> list = new ArrayList<ProductGroupHeadData>(); SQLiteDatabase db = AssetsDatabaseManager.getManager().getDatabase(); Cursor c = db.rawQuery( "SELECT PG1_ID,PG1_CU1_ID,PG1_CODE,PG1_Name FROM ProductGroupHead ORDER BY PG1_CODE", null); while (c.moveToNext()) { ProductGroupHeadData productGroupHead = new ProductGroupHeadData(); productGroupHead.setPg1Id(c.getString(c.getColumnIndex("PG1_ID"))); productGroupHead.setPg1Cu1Id(c.getString(c.getColumnIndex("PG1_CU1_ID"))); productGroupHead.setPg1Code(c.getString(c.getColumnIndex("PG1_CODE"))); productGroupHead.setPg1Name(c.getString(c.getColumnIndex("PG1_Name"))); list.add(productGroupHead); } return list; }