feat: add MaintenancePlan entity for preventive maintenance
This commit is contained in:
parent
ae177f3c87
commit
b650990f9e
|
|
@ -0,0 +1,85 @@
|
|||
package com.ether.pms.mdm.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "ops_maintenance_plan")
|
||||
@Data
|
||||
public class MaintenancePlan {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "project_id", nullable = false)
|
||||
private UUID projectId;
|
||||
|
||||
@Column(name = "plan_code", nullable = false, unique = true)
|
||||
private String planCode;
|
||||
|
||||
@Column(name = "plan_name", nullable = false)
|
||||
private String planName;
|
||||
|
||||
@Column(name = "equipment_type")
|
||||
private String equipmentType;
|
||||
|
||||
@Column(name = "trigger_type", nullable = false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TriggerType triggerType;
|
||||
|
||||
public enum TriggerType {
|
||||
TIME_BASED, // 时间触发
|
||||
HOURS_BASED, // 运行小时触发
|
||||
CYCLES_BASED, // 次数触发
|
||||
CONDITION_BASED // 条件触发
|
||||
}
|
||||
|
||||
@Column(name = "trigger_value")
|
||||
private Integer triggerValue;
|
||||
|
||||
@Column(name = "trigger_unit")
|
||||
private String triggerUnit;
|
||||
|
||||
@Column(name = "maintenance_items", columnDefinition = "TEXT")
|
||||
private String maintenanceItems;
|
||||
|
||||
@Column(name = "estimated_duration")
|
||||
private Integer estimatedDuration;
|
||||
|
||||
@Column(name = "assigned_to")
|
||||
private UUID assignedTo;
|
||||
|
||||
@Column(name = "sla_response_hours")
|
||||
private Integer slaResponseHours;
|
||||
|
||||
@Column(name = "sla_complete_hours")
|
||||
private Integer slaCompleteHours;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Status status = Status.ACTIVE;
|
||||
|
||||
public enum Status {
|
||||
ACTIVE, INACTIVE
|
||||
}
|
||||
|
||||
@Column(name = "created_at")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "updated_at")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
createdAt = LocalDateTime.now();
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void preUpdate() {
|
||||
updatedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue