write to scan_history table

This commit is contained in:
heyethereum
2024-07-15 00:29:39 +08:00
parent 1163648655
commit f293353d36
11 changed files with 221 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
package com.safeqr.app.qrcode.entity;
import jakarta.persistence.*;
import lombok.Builder;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
@@ -10,6 +11,7 @@ import java.util.UUID;
@Entity
@Table(name = "qr_code", schema = "safeqr")
@Data
@Builder
public class QRCode {
@Id
@@ -18,10 +20,8 @@ public class QRCode {
@Column(updatable = false, nullable = false)
private UUID id;
@ManyToOne
@JoinColumn(name = "qr_code_type_id", nullable = false)
private QRCodeType qrCodeType;
@Column(name = "qr_code_type_id", nullable = false)
private Long qrCodeTypeId;
private String userId;
private String contents;

View File

@@ -12,7 +12,6 @@ public class QRCodeType {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String type;
private String description;
private String prefix;

View File

@@ -0,0 +1,31 @@
package com.safeqr.app.qrcode.entity;
import jakarta.persistence.*;
import lombok.Builder;
import java.util.UUID;
@Entity
@Builder
@Table(name = "scan_history", schema = "safeqr")
public class ScanHistory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "qr_code_id", nullable = false)
private UUID qrCodeId;
@Column(name = "user_id", nullable = false)
private String userId;
@Enumerated(EnumType.STRING)
@Column(name = "status")
private ScanStatus scanStatus;
public enum ScanStatus {
ACTIVE,
INACTIVE
}
}