Files
no-copy/src/main/java/ru/soune/nocopy/entity/complaint/LawCase.java
T
vladp 29ed74745f
Test Workflow / test (push) Successful in 4s
dev add violation link
2026-04-07 15:35:32 +07:00

68 lines
1.6 KiB
Java

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
@NoArgsConstructor
@Builder
@Getter @Setter
@Table(name = "law_case")
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;
@Column(name = "violation_id")
private Long violationId;
@PrePersist
public void prePersist() {
if (this.createdAt == null) {
this.createdAt = LocalDateTime.now();
}
this.updatedAt = LocalDateTime.now();
}
}