Initial project
This commit is contained in:
82
src/main/java/com/imyeyu/spring/entity/BaseEntity.java
Normal file
82
src/main/java/com/imyeyu/spring/entity/BaseEntity.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.imyeyu.utils.Time;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 基本实体
|
||||
*
|
||||
* @author 夜雨
|
||||
* @version 2021-11-20 17:45
|
||||
*/
|
||||
public class BaseEntity implements Serializable, Creatable, Updatable, Deletable {
|
||||
|
||||
/** 创建时间 */
|
||||
protected Long createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
protected Long updatedAt;
|
||||
|
||||
/** 删除时间 */
|
||||
protected Long deletedAt;
|
||||
|
||||
/**
|
||||
* 获取创建时间
|
||||
*
|
||||
* @return 创建时间
|
||||
*/
|
||||
public Long getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置创建时间
|
||||
*
|
||||
* @param createdAt 创建时间
|
||||
*/
|
||||
public void setCreatedAt(Long createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取更新时间
|
||||
*
|
||||
* @return 更新时间
|
||||
*/
|
||||
public Long getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置更新时间
|
||||
*
|
||||
* @param updatedAt 更新时间
|
||||
*/
|
||||
public void setUpdatedAt(Long updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取删除时间
|
||||
*
|
||||
* @return 删除时间
|
||||
*/
|
||||
public Long getDeletedAt() {
|
||||
return deletedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置删除时间
|
||||
*
|
||||
* @param deletedAt 删除时间
|
||||
*/
|
||||
public void setDeletedAt(Long deletedAt) {
|
||||
this.deletedAt = deletedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return deletedAt != null && deletedAt < Time.now();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user