From c24d63c7343d8a9487eb71ac4fc07dc9dfe03caf Mon Sep 17 00:00:00 2001 From: geek Date: Fri, 4 May 2018 15:29:14 +0900 Subject: [PATCH] ing --- .../overflow/model/email/EmailAuth.java | 15 +++--- .../overflow/model/email/type/EmailType.java | 14 ------ .../overflow/model/meta/MetaEmailStatus.java | 48 +++++++++++++++++++ 3 files changed, 56 insertions(+), 21 deletions(-) delete mode 100644 src/main/java/com/loafle/overflow/model/email/type/EmailType.java create mode 100644 src/main/java/com/loafle/overflow/model/meta/MetaEmailStatus.java diff --git a/src/main/java/com/loafle/overflow/model/email/EmailAuth.java b/src/main/java/com/loafle/overflow/model/email/EmailAuth.java index 05a3b9f..1dbe12e 100644 --- a/src/main/java/com/loafle/overflow/model/email/EmailAuth.java +++ b/src/main/java/com/loafle/overflow/model/email/EmailAuth.java @@ -1,6 +1,7 @@ package com.loafle.overflow.model.email; import com.loafle.overflow.model.member.Member; +import com.loafle.overflow.model.meta.MetaEmailStatus; import javax.persistence.*; import java.util.Date; @@ -16,7 +17,7 @@ public class EmailAuth { private Date createDate; private Date authConfirmDate; private Member member; - private String emailType; + private MetaEmailStatus emailStatus; @Id @GeneratedValue(strategy= GenerationType.IDENTITY) @@ -68,13 +69,13 @@ public class EmailAuth { this.member = member; } - @Basic - @Column(name = "EMAIL_TYPE", nullable = true, length = 10) - public String getEmailType() { - return emailType; + @ManyToOne + @JoinColumn(name = "STATUS", nullable = false) + public MetaEmailStatus getEmailStatus() { + return emailStatus; } - public void setEmailType(String emailType) { - this.emailType = emailType; + public void setEmailStatus(MetaEmailStatus emailStatus) { + this.emailStatus = emailStatus; } } diff --git a/src/main/java/com/loafle/overflow/model/email/type/EmailType.java b/src/main/java/com/loafle/overflow/model/email/type/EmailType.java deleted file mode 100644 index e448cca..0000000 --- a/src/main/java/com/loafle/overflow/model/email/type/EmailType.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.loafle.overflow.model.email.type; - -public enum EmailType { - SIGNUP("SIGNUP"), - PASSWORD("PASSWORD"); - - private String stringValue; - EmailType(String string) {stringValue = string;} - - @Override - public String toString() { - return stringValue; - } -} diff --git a/src/main/java/com/loafle/overflow/model/meta/MetaEmailStatus.java b/src/main/java/com/loafle/overflow/model/meta/MetaEmailStatus.java new file mode 100644 index 0000000..a53cc97 --- /dev/null +++ b/src/main/java/com/loafle/overflow/model/meta/MetaEmailStatus.java @@ -0,0 +1,48 @@ +package com.loafle.overflow.model.meta; + +import javax.persistence.*; +import java.util.Date; + +@Entity +@Table(name = "META_EMAIL_STATUS", schema = "public") +public class MetaEmailStatus { + + private int id; + private String name; + private Date createDate; + + public MetaEmailStatus(){} + + public MetaEmailStatus(int id) { + this.id = id; + } + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } +}