@@ -2,6 +2,12 @@ package ru.soune.nocopy.entity.complaint;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import ru.soune.nocopy.entity.user.User;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@AllArgsConstructor
|
||||
@@ -14,4 +20,45 @@ public class LawCase {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
@ToString.Exclude
|
||||
private User user;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(length = 500, name = "description")
|
||||
private String description;
|
||||
|
||||
@Column(name = "amount")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "priority")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private LawCasePriority priority;
|
||||
|
||||
@Column(name = "type")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private LawCaseType type = LawCaseType.ACTIVE;
|
||||
|
||||
@CreatedDate
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@LastModifiedDate
|
||||
@Column(name = "updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Column(name = "lawyer")
|
||||
private String lawyer;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
if (this.createdAt == null) {
|
||||
this.createdAt = LocalDateTime.now();
|
||||
}
|
||||
this.updatedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user