package org.xmx0632.deliciousfruit.entity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
/**
* FruitSubPromotion.
*/
@Entity
@Table(name = "tbl_fruit_sub_promotion")
public class FruitSubPromotion extends IdEntity {
private FruitProduct product;
private String productName;
private FruitProduct promotionProduct;
private String promotionProductName;
private BigDecimal promotionPrice;
private int promotionThreshold = Integer.MAX_VALUE;
private int quantity; // 促销产品数量,赠送的时候为赠送产品的数量
private String unit;// 送的产品单位
private String spec;// 暂时不用,买的时候以FruitProduct.spec为准
private Date startTime;
private Date endTime;
public FruitSubPromotion() {
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@ManyToOne
@JoinColumn(name = "product_id")
@NotFound(action = NotFoundAction.IGNORE)
public FruitProduct getProduct() {
return product;
}
public void setProduct(FruitProduct product) {
this.product = product;
}
@ManyToOne
@JoinColumn(name = "promotion_product_id")
@NotFound(action = NotFoundAction.IGNORE)
public FruitProduct getPromotionProduct() {
return promotionProduct;
}
public void setPromotionProduct(FruitProduct promotionProduct) {
this.promotionProduct = promotionProduct;
}
public String getProductName() {
return this.productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
// public Long getPromotionProductId() {
// return this.promotionProductId;
// }
//
// public void setPromotionProductId(Long promotionProductId) {
// this.promotionProductId = promotionProductId;
// }
public String getPromotionProductName() {
return this.promotionProductName;
}
public void setPromotionProductName(String promotionProductName) {
this.promotionProductName = promotionProductName;
}
public BigDecimal getPromotionPrice() {
return this.promotionPrice;
}
public void setPromotionPrice(BigDecimal promotionPrice) {
this.promotionPrice = promotionPrice;
}
public int getPromotionThreshold() {
return this.promotionThreshold;
}
public void setPromotionThreshold(int promotionThreshold) {
this.promotionThreshold = promotionThreshold;
}
public String getUnit() {
return this.unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getSpec() {
return this.spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public Date getStartTime() {
return this.startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return this.endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}