拆分模块
This commit is contained in:
97
common/src/main/java/com/ecep/contract/model/Invoice.java
Normal file
97
common/src/main/java/com/ecep/contract/model/Invoice.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.ecep.contract.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 发票
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "INVOICE", schema = "supplier_ms")
|
||||
@ToString
|
||||
public class Invoice implements IdentityEntity, BasedEntity, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "ID", nullable = false)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 发票号
|
||||
*/
|
||||
@Column(name = "CODE")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 发票所属公司
|
||||
*/
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "COMPANY_ID")
|
||||
@ToString.Exclude
|
||||
private Company company;
|
||||
|
||||
/**
|
||||
* 发票开票日期
|
||||
*/
|
||||
@Column(name = "INVOICE_DATE")
|
||||
private LocalDate invoiceDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Column(name = "DESCRIPTION", columnDefinition = "TEXT")
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
public String toPrettyString() {
|
||||
if (StringUtils.hasText(getCode())) {
|
||||
return getCode();
|
||||
}
|
||||
return "#" + getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null)
|
||||
return false;
|
||||
Class<?> oEffectiveClass = o instanceof HibernateProxy
|
||||
? ((HibernateProxy) o).getHibernateLazyInitializer().getPersistentClass()
|
||||
: o.getClass();
|
||||
Class<?> thisEffectiveClass = this instanceof HibernateProxy
|
||||
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass()
|
||||
: this.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass)
|
||||
return false;
|
||||
Invoice invoice = (Invoice) o;
|
||||
return getId() != null && Objects.equals(getId(), invoice.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return this instanceof HibernateProxy
|
||||
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode()
|
||||
: getClass().hashCode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user