Member TOTP Model Service DAO created

This commit is contained in:
geek 2018-03-08 18:54:54 +09:00
parent c7b6d0d4c9
commit 5a982538c6
4 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package com.loafle.overflow.module.member.dao;
import com.loafle.overflow.module.member.model.MemberTotp;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
/**
* Created by geek on 18. 3. 8.
*/
@Repository
public interface MemberTotpDAO extends JpaRepository<MemberTotp, Long> {
@Query("select m from MemberTotp m WHERE m.secretCode = :secretCode")
MemberTotp findBySecretCode(@Param("secretCode") String secretCode);
}

View File

@ -22,6 +22,8 @@ public class Member {
private Date createDate;
private MetaMemberStatus status;
private int signinFailCount;
private MemberTotp totp;
private boolean totpType;
public Member() {
}
@ -120,4 +122,22 @@ public class Member {
this.signinFailCount = failCount;
}
@OneToOne
@JsonIgnore
@JoinColumn(name = "MEMBER_TOTP", nullable = true)
public MemberTotp getTotp() {
return totp;
}
public void setTotp(MemberTotp totp) {
this.totp = totp;
}
public boolean isTotpType() {
return totpType;
}
public void setTotpType(boolean totpType) {
this.totpType = totpType;
}
}

View File

@ -0,0 +1,63 @@
package com.loafle.overflow.module.member.model;
import javax.persistence.*;
import java.util.Date;
/**
* Created by geek on 18. 3. 8.
*/
@Entity
@Table(name = "MEMBER", schema = "public")
public class MemberTotp {
private long id;
private String secretCode;
private Date createDate;
private Date updateDate;
public MemberTotp() {
}
public MemberTotp(long id) {
this.id = id;
}
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Basic
@Column(name = "SECRET_CODE", nullable = false, length = 20)
public String getSecretCode() {
return secretCode;
}
public void setSecretCode(String secretCode) {
this.secretCode = secretCode;
}
@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;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = true)
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
}

View File

@ -0,0 +1,10 @@
package com.loafle.overflow.module.member.service;
import org.springframework.stereotype.Service;
/**
* Created by geek on 18. 3. 8.
*/
@Service("MemberTotpService")
public class MemberTotpService {
}