📄 cartitem.java
字号:
package com.ebookstore.dto;
import java.io.Serializable;
public class CartItem implements Serializable {
private Item item;// 订单明细
private int quantity;// 数量
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
// 获得当前明细的总价格
public double getTotalPrice() {
if (item != null) {
return item.getBaseprice() * item.getDiscount() * quantity;
} else {
return 0;
}
}
public void incrementQuantity() {
quantity++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -