fixed
apikey
This commit is contained in:
parent
15348b9066
commit
a9de2c2106
|
@ -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, Long> {
|
||||
// Apikey findByApiKey(Apikey apikey);
|
||||
public interface ApiKeyDao extends JpaRepository<ApiKey, Long> {
|
||||
// Apikeyddd findByApiKey(Apikeyddd apikey);
|
||||
}
|
||||
|
|
|
@ -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<Apikey> 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;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
|
@ -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;
|
||||
// }
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user