package cn.com.qmth.examcloud.core.questions.dao.entity.base;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class MongoBaseEntity implements JsonSerializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3471392332225060352L;
	
    @Id
    protected String id;

	/**
	 * 更新时间
	 */
	@LastModifiedDate
	@Column(nullable = true)
	@Temporal(TemporalType.TIMESTAMP)
	private Date updateDate;

	/**
	 * 创建时间
	 */
	@CreatedDate
	@Column(nullable = true, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date creationDate;
	
	/**
	 * 创建人id
	 */
	@CreatedBy
	@Column(nullable = true, updatable = false)
	private Long creationBy;
	
	
	/**
	 * 更新人id
	 */
	@LastModifiedBy
	@Column(nullable = true)
	private Long updateBy;

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Long getCreationBy() {
		return creationBy;
	}

	public void setCreationBy(Long creationBy) {
		this.creationBy = creationBy;
	}

	public Long getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(Long updateBy) {
		this.updateBy = updateBy;
	}


	
}