package cn.palmte.work.model; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; @MappedSuperclass public class ProjectBudgetCostProjectManageDetailBase { public static final int TYPE_PERSON = 1; public static final int TYPE_BUSINESS = 2; public static final int TYPE_OHTER = 3; /** * id */ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @GenericGenerator(name = "persistenceGenerator", strategy = "increment") private Integer id; @Column(name = "project_id") private int projectId; private int type; private String name; private String detail; private String unit; private BigDecimal amount; private BigDecimal price; @Column(name = "pay_time") @Temporal(TemporalType.TIMESTAMP) private Date payTime; @Column(name = "pay_amount") private BigDecimal payAmount; @Column(name = "predict_method") private String predictMethod; @Column(name = "predict_why") private String predictWhy; private String remark; @Transient private String name1; @Transient private String name2; @Column(name = "is_diy") private int isDiy; private BigDecimal total; public void setTotal(BigDecimal total) { this.total = total; } /** * 是否可以被删除,有些项是默认的不可删除,用于页面判断是否显示删除按钮 */ private int deletable; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public int getProjectId() { return projectId; } public void setProjectId(int projectId) { this.projectId = projectId; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public Date getPayTime() { return payTime; } public void setPayTime(Date payTime) { this.payTime = payTime; } public BigDecimal getPayAmount() { return payAmount; } public void setPayAmount(BigDecimal payAmount) { this.payAmount = payAmount; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getPredictMethod() { return predictMethod; } public void setPredictMethod(String predictMethod) { this.predictMethod = predictMethod; } public String getPredictWhy() { return predictWhy; } public void setPredictWhy(String predictWhy) { this.predictWhy = predictWhy; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public BigDecimal getTotal(){ if (total!=null){ return total; } if(null == price){ return BigDecimal.ZERO; } return price.multiply(amount); } public int getDeletable() { return deletable; } public void setDeletable(int deletable) { this.deletable = deletable; } public String getName1() { return name1; } public void setName1(String name1) { this.name1 = name1; } public String getName2() { return name2; } public void setName2(String name2) { this.name2 = name2; } public int getIsDiy() { return isDiy; } public void setIsDiy(int isDiy) { this.isDiy = isDiy; } }