package com.mes.device.entity; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import java.util.Date; /** * 设备交互执行记录实体类 * 对应数据库表:device_interaction_execution */ @Data @EqualsAndHashCode(callSuper = false) @TableName("device_interaction_execution") @Schema(name = "DeviceInteractionExecution", description = "设备交互执行记录") public class DeviceInteractionExecution { @Schema(description = "执行记录ID", example = "1") @TableId(value = "id", type = IdType.AUTO) private Long id; @Schema(description = "关联的交互逻辑ID", example = "1") @TableField("logic_id") private Long logicId; @Schema(description = "设备组ID", example = "1") @TableField("group_id") private Long groupId; @Schema(description = "所属项目ID", example = "1") @TableField("project_id") private Long projectId; @Schema(description = "执行批次号", example = "EXEC_20241030_001") @TableField("batch_no") private String batchNo; @Schema(description = "执行状态:0-等待,1-执行中,2-成功,3-失败,4-超时,5-取消", example = "0") @TableField("status") private Integer status; @Schema(description = "执行模式:1-手动,2-自动,3-定时", example = "2") @TableField("execution_mode") private Integer executionMode; @Schema(description = "开始执行时间") @TableField("start_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; @Schema(description = "结束执行时间") @TableField("end_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; @Schema(description = "执行耗时(毫秒)", example = "25000") @TableField("execution_duration") private Long executionDuration; @Schema(description = "执行进度:0-100", example = "80") @TableField("progress") private Integer progress; @Schema(description = "当前执行的步骤序号", example = "3") @TableField("current_step") private Integer currentStep; @Schema(description = "总步骤数", example = "10") @TableField("total_steps") private Integer totalSteps; @Schema(description = "成功执行的设备数量", example = "3") @TableField("success_devices") private Integer successDevices; @Schema(description = "失败的设备数量", example = "0") @TableField("failed_devices") private Integer failedDevices; @Schema(description = "触发执行的操作人", example = "admin") @TableField("triggered_by") private String triggeredBy; @Schema(description = "执行结果描述", example = "所有设备成功完成自动化测试") @TableField("result_message") private String resultMessage; @Schema(description = "错误信息JSON", example = "{\"deviceId\": 2, \"error\": \"Connection timeout\"}") @TableField("error_details") private String errorDetails; @Schema(description = "执行数据统计JSON", example = "{\"totalTime\": 25000, \"avgResponseTime\": 120}") @TableField("execution_stats") private String executionStats; @Schema(description = "扩展参数JSON", example = "{\"testDataId\": \"TD_001\", \"environment\": \"prod\"}") @TableField("extra_params") private String extraParams; @Schema(description = "创建时间") @TableField(value = "created_time", fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createdTime; @Schema(description = "更新时间") @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updatedTime; @Schema(description = "创建人", example = "system") @TableField(value = "created_by", fill = FieldFill.INSERT) private String createdBy; @Schema(description = "更新人", example = "system") @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE) private String updatedBy; @Schema(description = "是否删除:0-否,1-是", example = "0") @TableField("is_deleted") @TableLogic private Integer isDeleted; // 执行状态枚举 public static final class Status { public static final int WAITING = 0; // 等待 public static final int RUNNING = 1; // 执行中 public static final int SUCCESS = 2; // 成功 public static final int FAILED = 3; // 失败 public static final int TIMEOUT = 4; // 超时 public static final int CANCELLED = 5; // 取消 } // 执行模式枚举 public static final class ExecutionMode { public static final int MANUAL = 1; // 手动 public static final int AUTOMATIC = 2; // 自动 public static final int SCHEDULED = 3; // 定时 } }