model
This commit is contained in:
parent
9224ce21a9
commit
15348b9066
|
@ -1,94 +0,0 @@
|
||||||
package com.loafle.overflow.models;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by root on 17. 6. 22.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "TBL_EMAIL_AUTH", schema = "public", catalog = "postgres")
|
|
||||||
public class TblEmailAuth {
|
|
||||||
private long id;
|
|
||||||
private String emailAuthKey;
|
|
||||||
private Timestamp createDate;
|
|
||||||
private Timestamp authConfirmDate;
|
|
||||||
private long memberId;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "ID", nullable = false)
|
|
||||||
public long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(name = "EMAIL_AUTH_KEY", nullable = true, length = 50)
|
|
||||||
public String getEmailAuthKey() {
|
|
||||||
return emailAuthKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmailAuthKey(String emailAuthKey) {
|
|
||||||
this.emailAuthKey = emailAuthKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(name = "CREATE_DATE", nullable = false)
|
|
||||||
public Timestamp getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateDate(Timestamp createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(name = "AUTH_CONFIRM_DATE", nullable = true)
|
|
||||||
public Timestamp getAuthConfirmDate() {
|
|
||||||
return authConfirmDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthConfirmDate(Timestamp authConfirmDate) {
|
|
||||||
this.authConfirmDate = authConfirmDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
@Column(name = "MEMBER_ID", nullable = false)
|
|
||||||
public long getMemberId() {
|
|
||||||
return memberId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMemberId(long memberId) {
|
|
||||||
this.memberId = memberId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
TblEmailAuth that = (TblEmailAuth) o;
|
|
||||||
|
|
||||||
if (id != that.id) return false;
|
|
||||||
if (memberId != that.memberId) return false;
|
|
||||||
if (emailAuthKey != null ? !emailAuthKey.equals(that.emailAuthKey) : that.emailAuthKey != null) return false;
|
|
||||||
if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
|
|
||||||
if (authConfirmDate != null ? !authConfirmDate.equals(that.authConfirmDate) : that.authConfirmDate != null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = (int) (id ^ (id >>> 32));
|
|
||||||
result = 31 * result + (emailAuthKey != null ? emailAuthKey.hashCode() : 0);
|
|
||||||
result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
|
|
||||||
result = 31 * result + (authConfirmDate != null ? authConfirmDate.hashCode() : 0);
|
|
||||||
result = 31 * result + (int) (memberId ^ (memberId >>> 32));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -43,17 +43,4 @@ public class Domain {
|
||||||
this.createDate = createDate;
|
this.createDate = createDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
Domain tblDomain = (Domain) o;
|
|
||||||
|
|
||||||
if (id != tblDomain.id) return false;
|
|
||||||
if (name != null ? !name.equals(tblDomain.name) : tblDomain.name != null) return false;
|
|
||||||
if (createDate != null ? !createDate.equals(tblDomain.createDate) : tblDomain.createDate != null) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.loafle.overflow.module.email.dao;
|
package com.loafle.overflow.module.email.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.module.email.model.EmailAuth;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek@loafle.com on 17. 6. 6.
|
* Created by geek@loafle.com on 17. 6. 6.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,111 +1,69 @@
|
||||||
package com.loafle.overflow.module.email.model;
|
package com.loafle.overflow.module.email.model;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.sql.Timestamp;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek@loafle.com on 17. 6. 6.
|
* Created by root on 17. 6. 22.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@Entity
|
||||||
@Entity(name="EMAIL_AUTH")
|
@Table(name = "TBL_EMAIL_AUTH", schema = "public", catalog = "postgres")
|
||||||
public class EmailAuth implements Serializable {
|
public class EmailAuth {
|
||||||
|
private long id;
|
||||||
|
private String emailAuthKey;
|
||||||
|
private Timestamp createDate;
|
||||||
|
private Timestamp authConfirmDate;
|
||||||
|
private Member member;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||||
private Long id;
|
public long getId() {
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "MEMBER_ID", nullable=false)
|
|
||||||
private Member member;
|
|
||||||
|
|
||||||
@Column(name="AUTH_TOKEN", unique=true, nullable=false)
|
|
||||||
private String authToken;
|
|
||||||
|
|
||||||
@Column(name = "IS_INVALID")
|
|
||||||
private Boolean isInvalid;
|
|
||||||
|
|
||||||
@Column(name = "IS_CONFIRM")
|
|
||||||
private Boolean isConfirm;
|
|
||||||
|
|
||||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
|
||||||
private Date createDate;
|
|
||||||
|
|
||||||
@Column(name = "UPDATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = true)
|
|
||||||
private Date updateDate;
|
|
||||||
|
|
||||||
@Column(name = "CONFIRM_DATE")
|
|
||||||
private Date confirmDate;
|
|
||||||
|
|
||||||
public EmailAuth() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public EmailAuth(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "EMAIL_AUTH_KEY", nullable = true, length = 50)
|
||||||
|
public String getEmailAuthKey() {
|
||||||
|
return emailAuthKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailAuthKey(String emailAuthKey) {
|
||||||
|
this.emailAuthKey = emailAuthKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
|
public Timestamp getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDate(Timestamp createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "AUTH_CONFIRM_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||||
|
public Timestamp getAuthConfirmDate() {
|
||||||
|
return authConfirmDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthConfirmDate(Timestamp authConfirmDate) {
|
||||||
|
this.authConfirmDate = authConfirmDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
@Column(name = "MEMBER_ID", nullable = false)
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMember(Member member) {
|
public void setMember(Member memberId) {
|
||||||
this.member = member;
|
this.member = member;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthToken() {
|
|
||||||
return authToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthToken(String authToken) {
|
|
||||||
this.authToken = authToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getIsInvalid() {
|
|
||||||
return isInvalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsInvalid(Boolean invalid) {
|
|
||||||
isInvalid = invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getIsConfirm() {
|
|
||||||
return isConfirm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsConfirm(Boolean confirm) {
|
|
||||||
isConfirm = confirm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateDate() {
|
|
||||||
return updateDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateDate(Date updateDate) {
|
|
||||||
this.updateDate = updateDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getConfirmDate() {
|
|
||||||
return confirmDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConfirmDate(Date confirmDate) {
|
|
||||||
this.confirmDate = confirmDate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
//package com.loafle.overflow.module.member.dao;
|
|
||||||
//
|
|
||||||
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
|
||||||
//import com.loafle.overflow.module.member.model.Member;
|
|
||||||
//
|
|
||||||
//import javax.persistence.Query;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by insanity on 17. 5. 25.
|
|
||||||
// */
|
|
||||||
//public class JPAMemberDAO extends JPABaseDAO<Member> implements MemberDAO{
|
|
||||||
// public Member findByEmail(Member member) {
|
|
||||||
//
|
|
||||||
// Query query = getEntityManager().createNativeQuery("SELECT m.* FROM MEMBER m WHERE m.email = :email", Member.class);
|
|
||||||
// query.setParameter("email", member.getEmail());
|
|
||||||
//
|
|
||||||
// Member retMember = null;
|
|
||||||
// try {
|
|
||||||
// retMember = (Member)query.getSingleResult();
|
|
||||||
// }catch(Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }finally {
|
|
||||||
// return retMember;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.loafle.overflow.module.member.dao;
|
package com.loafle.overflow.module.member.dao;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,5 +10,6 @@ import org.springframework.stereotype.Repository;
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface MemberDAO extends JpaRepository<Member, Long> {
|
public interface MemberDAO extends JpaRepository<Member, Long> {
|
||||||
// public Member findByEmail(Member member);
|
@Query("SELECT m FROM MEMBER m WHERE m.email = :email")
|
||||||
|
Member findByEmail(Member member);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user