81 lines
2.3 KiB
Java
81 lines
2.3 KiB
Java
package com.ecep.contract.model;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Objects;
|
|
|
|
import org.hibernate.proxy.HibernateProxy;
|
|
|
|
import com.ecep.contract.ProjectFileType;
|
|
|
|
import jakarta.persistence.Column;
|
|
import jakarta.persistence.Entity;
|
|
import jakarta.persistence.EnumType;
|
|
import jakarta.persistence.Enumerated;
|
|
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 = "PROJECT_FILE")
|
|
@ToString
|
|
public class ProjectFile implements IdentityEntity, ProjectBasedEntity, Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@Column(name = "ID", nullable = false)
|
|
private Integer id;
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "PROJECT_ID")
|
|
@ToString.Exclude
|
|
private Project project;
|
|
|
|
@Column(name = "TYPE")
|
|
@Enumerated(EnumType.STRING)
|
|
private ProjectFileType type;
|
|
|
|
/**
|
|
* 资质文件路径,全路径,网盘地址
|
|
*/
|
|
@Column(name = "FILE_PATH")
|
|
private String filePath;
|
|
|
|
@Override
|
|
public final boolean equals(Object object) {
|
|
if (this == object)
|
|
return true;
|
|
if (object == null)
|
|
return false;
|
|
Class<?> oEffectiveClass = object instanceof HibernateProxy
|
|
? ((HibernateProxy) object).getHibernateLazyInitializer().getPersistentClass()
|
|
: object.getClass();
|
|
Class<?> thisEffectiveClass = this instanceof HibernateProxy
|
|
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass()
|
|
: this.getClass();
|
|
if (thisEffectiveClass != oEffectiveClass)
|
|
return false;
|
|
ProjectFile that = (ProjectFile) object;
|
|
return getId() != null && Objects.equals(getId(), that.getId());
|
|
}
|
|
|
|
@Override
|
|
public final int hashCode() {
|
|
return this instanceof HibernateProxy
|
|
? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode()
|
|
: getClass().hashCode();
|
|
}
|
|
}
|