All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feingto.cloud.domain.BaseEntity Maven / Gradle / Ivy

There is a newer version: 2.3.5.RELEASE
Show newest version
package com.feingto.cloud.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.feingto.cloud.data.jpa.entity.IdEntity;
import com.feingto.cloud.kit.DateKit;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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 javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * @author longfei
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
public abstract class BaseEntity extends IdEntity implements Serializable {
    private static final long serialVersionUID = -5912239758917521877L;

    @CreatedBy
    @Size(max = 50)
    @Column(name = "created_by", length = 50, updatable = false, nullable = false)
    protected String createdBy;

    @JsonFormat(pattern = DateKit.DATE_TIME, timezone = "GMT+8")
    @CreatedDate
    @Column(name = "created_date", updatable = false, nullable = false)
    protected Date createdDate = new Date();

    @Size(max = 50)
    @LastModifiedBy
    @Column(name = "last_modified_by", length = 50)
    protected String lastModifiedBy;

    @JsonFormat(pattern = DateKit.DATE_TIME, timezone = "GMT+8")
    @LastModifiedDate
    @Column(name = "last_modified_date")
    protected Date lastModifiedDate = new Date();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy