added advertising
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.krylov.refound.entity.advertising;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "click")
|
||||
@Getter
|
||||
@Setter
|
||||
public class Click {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "advertising_id", nullable = false)
|
||||
private Advertising advertising;
|
||||
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column(name = "clicked_at", nullable = false)
|
||||
private LocalDateTime clickedAt;
|
||||
|
||||
@Column(name = "session_id")
|
||||
private String sessionId;
|
||||
|
||||
@PrePersist
|
||||
protected void onCreate() {
|
||||
if (clickedAt == null) {
|
||||
clickedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user