initial
This commit is contained in:
67
src/main/java/com/pmu/betengine/model/TPE.java
Normal file
67
src/main/java/com/pmu/betengine/model/TPE.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.pmu.betengine.model;
|
||||
|
||||
import com.pmu.betengine.model.statut.StatutTPE;
|
||||
import com.pmu.betengine.model.type.TypeTPE;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "tpe", uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = "imei"),
|
||||
@UniqueConstraint(columnNames = "serial")
|
||||
})
|
||||
public class TPE {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "L'IMEI est obligatoire")
|
||||
@Column(unique = true, nullable = false, length = 15)
|
||||
private String imei;
|
||||
|
||||
@NotBlank(message = "Le numéro de série est obligatoire")
|
||||
@Column(unique = true, nullable = false)
|
||||
private String serial;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@NotNull(message = "Le type est obligatoire")
|
||||
@Column(nullable = false)
|
||||
private TypeTPE type;
|
||||
|
||||
@NotBlank(message = "La marque est obligatoire")
|
||||
@Column(nullable = false)
|
||||
private String marque;
|
||||
|
||||
@NotBlank(message = "Le modèle est obligatoire")
|
||||
@Column(nullable = false)
|
||||
private String modele;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
@Column(nullable = false)
|
||||
private StatutTPE statut = StatutTPE.DISPONIBLE;
|
||||
|
||||
@Column(nullable = false)
|
||||
private boolean assigne = false;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(nullable = false, updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@UpdateTimestamp
|
||||
@Column(nullable = false)
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
Reference in New Issue
Block a user