@Override public List<MedicineStorehouse> queryNotExpired(MedicineStorehouse vo, PageResult page) { List<Object> objList = dao.queryNotExpired(vo, page); List<MedicineStorehouse> list = new ArrayList<MedicineStorehouse>(); MedicineStorehouse m = null; for (Object obj : objList) { m = new MedicineStorehouse(); Object[] o = (Object[]) obj; Long id = MathUtil.valueToLong(o[0]); Long medicineId = MathUtil.valueToLong(o[1]); String medicineName = (String) o[2]; Date mfg = (Date) o[3]; Date exp = (Date) o[4]; int number = (int) o[5]; double price = (double) o[6]; Long purchaseId = MathUtil.valueToLong(o[7]); double costPrice = (double) o[8]; m.setId(id); m.setMedicineId(medicineId); m.setMfg(mfg); m.setExp(exp); m.setNumber(number); m.setPrice(price); m.setPurchaseId(purchaseId); m.setMedicineName(medicineName); m.setCostPrice(costPrice); list.add(m); } return list; }
@Override public boolean dealWith(MedicineStorehouse vo) { boolean isFlag = false; MedicineStorehouse m = dao.queryById(vo); MedicinePurchase p = new MedicinePurchase(); p.setId(m.getPurchaseId()); p = purchaseDao.queryById(p); m.setPrice(0 - p.getCostPrice()); dao.update(m); isFlag = true; return isFlag; }