/** * 订单项类,包含订单中的商品信息 */ package com.orderprocessing; public class OrderItem { private String productId; private String productName; private int quantity; private double price; // 构造方法 public OrderItem(String productId, String productName, int quantity, double price) { this.productId = productId; this.productName = productName; this.quantity = quantity; this.price = price; } // getter方法 public String getProductId() { return productId; } public String getProductName() { return productName; } public int getQuantity() { return quantity; } public double getPrice() { return price; } @Override public String toString() { return "OrderItem{" + "productId='" + productId + '\'' + ", productName='" + productName + '\'' + ", quantity=" + quantity + ", price=" + price + '}'; } }