From a9de2c21068b6edd3042b3615b0bfe121e527f98 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 22 Jun 2017 19:26:22 +0900 Subject: [PATCH] fixed apikey --- .../overflow/module/apikey/dao/ApiKeyDao.java | 7 +- .../module/apikey/dao/JPAApiKeyDao.java | 28 ------- .../overflow/module/apikey/model/ApiKey.java | 83 +++++++++++++++++++ .../overflow/module/apikey/model/Apikey.java | 59 ------------- 4 files changed, 87 insertions(+), 90 deletions(-) delete mode 100644 src/main/java/com/loafle/overflow/module/apikey/dao/JPAApiKeyDao.java create mode 100644 src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java delete mode 100644 src/main/java/com/loafle/overflow/module/apikey/model/Apikey.java diff --git a/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDao.java b/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDao.java index a42deda..094d482 100644 --- a/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDao.java +++ b/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDao.java @@ -1,6 +1,7 @@ package com.loafle.overflow.module.apikey.dao; -import com.loafle.overflow.module.apikey.model.Apikey; +import com.loafle.overflow.module.apikey.model.ApiKey; + import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @@ -9,6 +10,6 @@ import org.springframework.stereotype.Repository; * Created by root on 17. 6. 1. */ @Repository -public interface ApiKeyDao extends JpaRepository { -// Apikey findByApiKey(Apikey apikey); +public interface ApiKeyDao extends JpaRepository { +// Apikeyddd findByApiKey(Apikeyddd apikey); } diff --git a/src/main/java/com/loafle/overflow/module/apikey/dao/JPAApiKeyDao.java b/src/main/java/com/loafle/overflow/module/apikey/dao/JPAApiKeyDao.java deleted file mode 100644 index b1433f4..0000000 --- a/src/main/java/com/loafle/overflow/module/apikey/dao/JPAApiKeyDao.java +++ /dev/null @@ -1,28 +0,0 @@ -//package com.loafle.overflow.module.apikey.dao; -// -//import com.loafle.overflow.module.apikey.model.Apikey; -//import com.loafle.overflow.commons.dao.JPABaseDAO; -// -// -//import javax.persistence.Query; -// -///** -// * Created by root on 17. 6. 1. -// */ -//public class JPAApiKeyDao extends JPABaseDAO implements ApiKeyDao { -// public Apikey findByApiKey(Apikey apikey) { -// -// Query query = getEntityManager().createNativeQuery("SELECT ak.* FROM API_KEY ak WHERE ak.API_KEY = :apikey", Apikey.class); -// query.setParameter("apikey", apikey.getApiKey()); -// -// Apikey ak = null; -// try { -// ak = (Apikey)query.getSingleResult(); -// }catch(Exception e) { -// e.printStackTrace(); -// }finally { -// return ak; -// } -// -// } -//} diff --git a/src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java b/src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java new file mode 100644 index 0000000..b9f1ccb --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java @@ -0,0 +1,83 @@ +package com.loafle.overflow.module.apikey.model; + +import com.loafle.overflow.module.domain.Domain; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "TBL_API_KEY", schema = "public", catalog = "postgres") +public class ApiKey { + private long id; + private String apiKey; + private Date createDate; + private Domain domain; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "API_KEY", nullable = false, length = 50) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="CREATE_DATE", nullable=false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @ManyToOne + @JoinColumn(name = "DOMAIN_ID", nullable=false) + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } +// +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// TblApiKey tblApiKey = (TblApiKey) o; +// +// if (id != tblApiKey.id) return false; +// if (domainId != tblApiKey.domainId) return false; +// if (apiKey != null ? !apiKey.equals(tblApiKey.apiKey) : tblApiKey.apiKey != null) return false; +// if (createDate != null ? !createDate.equals(tblApiKey.createDate) : tblApiKey.createDate != null) return false; +// +// return true; +// } +// +// @Override +// public int hashCode() { +// int result = (int) (id ^ (id >>> 32)); +// result = 31 * result + (apiKey != null ? apiKey.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + (int) (domainId ^ (domainId >>> 32)); +// return result; +// } +} diff --git a/src/main/java/com/loafle/overflow/module/apikey/model/Apikey.java b/src/main/java/com/loafle/overflow/module/apikey/model/Apikey.java deleted file mode 100644 index 0060ed6..0000000 --- a/src/main/java/com/loafle/overflow/module/apikey/model/Apikey.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.loafle.overflow.module.apikey.model; - -import javax.persistence.*; -import java.util.Date; - -/** - * Created by root on 17. 6. 1. - */ -@Entity -@Table(name ="API_KEY") -public class Apikey { - - @Id - @GeneratedValue(strategy= GenerationType.IDENTITY) - private Long id; - - @Column(name="API_KEY", unique=true, nullable=false) - private String apiKey; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name="CREATE_DATE", nullable=false) - private Date createDate; - - @ManyToOne - @JoinColumn(name = "MEMBER_ID", nullable=false) - private Member member; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public Date getCreateDate() { - return createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - public Member getMember() { - return member; - } - - public void setMember(Member member) { - this.member = member; - } -}