|
@ -0,0 +1,36 @@
|
|
|
package com.yihu.jw.entity;
|
|
|
|
|
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
|
|
|
|
import javax.persistence.*;
|
|
|
import java.io.Serializable;
|
|
|
|
|
|
/**
|
|
|
* 由于ORACEL 与mysql Id策略不一样
|
|
|
* Integer类型的主键基类,需要根据不同环境打包
|
|
|
* Created by progr1mmer on 2018/8/13.
|
|
|
*/
|
|
|
@MappedSuperclass
|
|
|
@EntityListeners(AuditingEntityListener.class)
|
|
|
public abstract class LongIdentityEntity implements Serializable {
|
|
|
|
|
|
protected Long id;
|
|
|
|
|
|
@Id
|
|
|
//==========mysql 环境 id策略======================================================
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
@Column(name = "id", unique = true, nullable = false)
|
|
|
//==========mysql 环境 id策略 end======================================================
|
|
|
|
|
|
//==========Oracle 环境id策略 =========================================================
|
|
|
/* @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
|
|
|
//==========Oracle 环境id策略 =========================================================
|
|
|
public Long getId() {
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
public void setId(Long id) {
|
|
|
this.id = id;
|
|
|
}
|
|
|
|
|
|
}
|