You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
/**
|
|
* 订单项类,包含订单中的商品信息
|
|
*/
|
|
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 +
|
|
'}';
|
|
}
|
|
} |