/** * TODO 修改购物车里食物的数量(可选). * * @see com.yummy.service.ICartManager#update(int, int) */ public void update(int id, int quantities) { // TODO Auto-generated method stub for (int i = 0; i < items.size(); i++) { ItemDTO temp = items.get(i); if (temp.getId() == id) { temp.setOrderCount(quantities); } } }
/** * TODO 增加数量,用户重复点击放入购物车时调用。(可选). * * @see com.yummy.service.ICartManager#increase(int, int) */ public void increase(int id, int quantities) { // TODO Auto-generated method stub for (int i = 0; i < items.size(); i++) { if (items.get(i).getId() == id) { ItemDTO temp = items.get(i); temp.setOrderCount(temp.getOrderCount() + quantities); break; } } }