拆分模块

This commit is contained in:
2025-09-03 20:56:44 +08:00
parent 08cc2c29a5
commit a2f5e4864b
939 changed files with 14227 additions and 9607 deletions

View File

@@ -0,0 +1,83 @@
package com.ecep.contract.cloud;
import java.time.Instant;
import java.util.Objects;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.proxy.HibernateProxy;
import com.ecep.contract.model.Company;
import com.ecep.contract.model.IdentityEntity;
import jakarta.persistence.Column;
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.MappedSuperclass;
import jakarta.persistence.Version;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 记录同步来源
*/
@Getter
@Setter
// @Entity
// @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@ToString
@MappedSuperclass
public abstract class CloudBaseInfo implements IdentityEntity {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable = false)
private Integer id;
/**
* 平台编号
*/
@Column(name = "CLOUD_ID")
private String cloudId;
/**
* 本地更新时间戳,控制更新频率和重复更新
*/
@Column(name = "LATEST_UPDATE")
private Instant latestUpdate;
/**
* 关联的公司
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "COMPANY_ID")
@ToString.Exclude
private Company company;
@Version
@ColumnDefault("0")
@Column(name = "VERSION", nullable = false)
private int version;
@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;
CloudBaseInfo cloudInfo = (CloudBaseInfo) o;
return getId() != null && Objects.equals(getId(), cloudInfo.getId());
}
@Override
public final int hashCode() {
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
}
}