Author: Yang Lu School: Liaoning Institute of Science and Technology Major: Computer Science and Technology Class: BZ246 Tech Stack: - Backend: Spring Boot 2.7.18 + JPA + MySQL - Frontend: HTML5 + CSS3 + JavaScript Features: - User Management (Admin/Staff/Customer roles) - Vehicle Archive Management - Service Order Management - Parts Inventory Management - Online Appointment Service - Data Statistics and Analysis Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
106 lines
2.9 KiB
Java
106 lines
2.9 KiB
Java
package com.carmaintenance.entity;
|
|
|
|
import lombok.Data;
|
|
import org.springframework.data.annotation.CreatedDate;
|
|
import org.springframework.data.annotation.LastModifiedDate;
|
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
|
|
import javax.persistence.*;
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDateTime;
|
|
|
|
/**
|
|
* 维保工单实体
|
|
*/
|
|
@Data
|
|
@Entity
|
|
@Table(name = "service_orders")
|
|
@EntityListeners(AuditingEntityListener.class)
|
|
public class ServiceOrder {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@Column(name = "order_id")
|
|
private Integer orderId;
|
|
|
|
@Column(name = "order_no", nullable = false, unique = true, length = 50)
|
|
private String orderNo;
|
|
|
|
@Column(name = "vehicle_id", nullable = false)
|
|
private Integer vehicleId;
|
|
|
|
@Column(name = "customer_id", nullable = false)
|
|
private Integer customerId;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "service_type", nullable = false)
|
|
private ServiceType serviceType;
|
|
|
|
@Column(name = "appointment_time")
|
|
private LocalDateTime appointmentTime;
|
|
|
|
@Column(name = "arrival_time")
|
|
private LocalDateTime arrivalTime;
|
|
|
|
@Column(name = "start_time")
|
|
private LocalDateTime startTime;
|
|
|
|
@Column(name = "complete_time")
|
|
private LocalDateTime completeTime;
|
|
|
|
@Column(name = "staff_id")
|
|
private Integer staffId;
|
|
|
|
@Column(name = "current_mileage", precision = 10, scale = 2)
|
|
private BigDecimal currentMileage;
|
|
|
|
@Column(name = "fault_description", columnDefinition = "TEXT")
|
|
private String faultDescription;
|
|
|
|
@Column(name = "diagnosis_result", columnDefinition = "TEXT")
|
|
private String diagnosisResult;
|
|
|
|
@Column(name = "service_items", columnDefinition = "TEXT")
|
|
private String serviceItems;
|
|
|
|
@Column(name = "parts_cost", precision = 10, scale = 2)
|
|
private BigDecimal partsCost = BigDecimal.ZERO;
|
|
|
|
@Column(name = "labor_cost", precision = 10, scale = 2)
|
|
private BigDecimal laborCost = BigDecimal.ZERO;
|
|
|
|
@Column(name = "total_cost", precision = 10, scale = 2)
|
|
private BigDecimal totalCost = BigDecimal.ZERO;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "status")
|
|
private OrderStatus status = OrderStatus.pending;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "payment_status")
|
|
private PaymentStatus paymentStatus = PaymentStatus.unpaid;
|
|
|
|
@Column(name = "remark", columnDefinition = "TEXT")
|
|
private String remark;
|
|
|
|
@CreatedDate
|
|
@Column(name = "create_time", updatable = false)
|
|
private LocalDateTime createTime;
|
|
|
|
@LastModifiedDate
|
|
@Column(name = "update_time")
|
|
private LocalDateTime updateTime;
|
|
|
|
public enum ServiceType {
|
|
maintenance, repair, beauty, insurance
|
|
}
|
|
|
|
public enum OrderStatus {
|
|
pending, appointed, in_progress, completed, cancelled
|
|
}
|
|
|
|
public enum PaymentStatus {
|
|
unpaid, paid, refunded
|
|
}
|
|
}
|