-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
src/main/java/com/dl/officialsite/nft/bean/MemberNFTMintRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.dl.officialsite.nft.bean; | ||
|
||
import com.dl.officialsite.nft.constant.ContractNameEnum; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
import javax.persistence.UniqueConstraint; | ||
import javax.validation.constraints.NotNull; | ||
import java.io.Serializable; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@ToString | ||
@EqualsAndHashCode(onlyExplicitlyIncluded = true) | ||
@EntityListeners(AuditingEntityListener.class) | ||
@Entity | ||
@DynamicUpdate | ||
@Table(name = "member_nft_mint_record", schema = "dl", uniqueConstraints = { | ||
@UniqueConstraint(name = "unique_mint_record", columnNames = { | ||
"address", "contractName", "chainId" | ||
}) | ||
}) | ||
public class MemberNFTMintRecord implements Serializable { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(length = 42) | ||
@NotNull | ||
private String address; | ||
|
||
@NotNull | ||
@Column(length = 16) | ||
@Enumerated(EnumType.STRING) | ||
private ContractNameEnum contractName; | ||
|
||
@Column(length = 32) | ||
@NotNull | ||
private String chainId; | ||
|
||
private int rankValue = -1; | ||
|
||
@CreatedDate | ||
@Column(updatable = false) | ||
private Long mintTime; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/dl/officialsite/nft/bean/MemberNFTMintRecordRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.dl.officialsite.nft.bean; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.Optional; | ||
|
||
public interface MemberNFTMintRecordRepository | ||
extends JpaRepository<MemberNFTMintRecord, Long>, JpaSpecificationExecutor<MemberNFTMintRecord> { | ||
|
||
@Query(value = "select * from member_nft_mint_record where address =:address and contract_name=:contractName and " + | ||
"chain_id=:chainId", nativeQuery = true) | ||
Optional<MemberNFTMintRecord> findByAddressAndContractNameAndChainId(@Param("address") String address, | ||
@Param("contractName") String contractName, | ||
@Param("chainId") String chainId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters