|
| 1 | +package com.flow.file.common.entity; |
| 2 | + |
| 3 | +import java.time.LocalDateTime; |
| 4 | + |
| 5 | +import org.springframework.data.annotation.CreatedDate; |
| 6 | +import org.springframework.data.annotation.LastModifiedBy; |
| 7 | +import org.springframework.data.annotation.LastModifiedDate; |
| 8 | +import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
| 9 | + |
| 10 | +import jakarta.persistence.Column; |
| 11 | +import jakarta.persistence.EntityListeners; |
| 12 | +import jakarta.persistence.MappedSuperclass; |
| 13 | +import jakarta.persistence.PrePersist; |
| 14 | +import jakarta.persistence.Version; |
| 15 | +import lombok.Getter; |
| 16 | +import lombok.NoArgsConstructor; |
| 17 | +import lombok.experimental.SuperBuilder; |
| 18 | + |
| 19 | +@MappedSuperclass |
| 20 | +@EntityListeners(AuditingEntityListener.class) |
| 21 | +@Getter |
| 22 | +@SuperBuilder |
| 23 | +@NoArgsConstructor |
| 24 | +public class BaseEntity { |
| 25 | + |
| 26 | + @Column(name = "use_yn") |
| 27 | + private boolean useYn; |
| 28 | + |
| 29 | + @Column(name = "create_code", updatable = false) |
| 30 | + private String createCode; |
| 31 | + |
| 32 | + @CreatedDate |
| 33 | + @Column(name = "create_date", updatable = false) |
| 34 | + private LocalDateTime createDate; |
| 35 | + |
| 36 | + @LastModifiedBy |
| 37 | + @Column(name = "modify_code") |
| 38 | + private String modifyCode; |
| 39 | + |
| 40 | + @LastModifiedDate |
| 41 | + @Column(name = "modify_date") |
| 42 | + private LocalDateTime modifyDate; |
| 43 | + |
| 44 | + @Column(name = "delete_code") |
| 45 | + private String deleteCode; |
| 46 | + |
| 47 | + @Column(name = "delete_date") |
| 48 | + private LocalDateTime deleteDate; |
| 49 | + |
| 50 | + @Version |
| 51 | + public int version; |
| 52 | + |
| 53 | + @PrePersist |
| 54 | + public void prePersist() { |
| 55 | + this.createDate = LocalDateTime.now(); |
| 56 | + this.createCode = "flow-payment"; |
| 57 | + this.useYn = true; |
| 58 | + } |
| 59 | +} |
0 commit comments