Files
no-copy/src/main/java/ru/soune/nocopy/entity/complaint/LawCase.java
T

68 lines
1.6 KiB
Java
Raw Normal View History

2026-03-23 15:17:42 +07:00
package ru.soune.nocopy.entity.complaint;
import jakarta.persistence.*;
import lombok.*;
2026-04-06 14:51:00 +07:00
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;
2026-03-23 15:17:42 +07:00
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Getter @Setter
@Table(name = "law_case")
public class LawCase {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
2026-04-06 14:51:00 +07:00
@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;
2026-04-07 15:35:32 +07:00
@Column(name = "violation_id")
private Long violationId;
2026-04-06 14:51:00 +07:00
@PrePersist
public void prePersist() {
if (this.createdAt == null) {
this.createdAt = LocalDateTime.now();
}
this.updatedAt = LocalDateTime.now();
}
2026-03-23 15:17:42 +07:00
}