You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SmartGymManagementSystem/MaintenanceRecord.java

46 lines
1.1 KiB

package com.gym.model;
import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Entity
@Table(name = "maintenance_record")
@Data
public class MaintenanceRecord {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "equipment_id", nullable = false)
private Long equipmentId;
@Column(name = "maintenance_date", nullable = false)
private LocalDate maintenanceDate;
@Column(name = "maintainer_id")
private Long maintainerId;
@Column(name = "maintainer_name", length = 100)
private String maintainerName;
@Column(columnDefinition = "TEXT")
private String notes;
@Column(length = 20)
private String status = "COMPLETED"; // COMPLETED, PENDING, CANCELLED
@Column(name = "created_at")
private LocalDateTime createdAt;
@PrePersist
protected void onCreate() {
if (createdAt == null) {
createdAt = LocalDateTime.now();
}
if (maintenanceDate == null) {
maintenanceDate = LocalDate.now();
}
}
}