huang
2025-11-20 366ba040d2447bacd3455299425e3166f1f992bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package com.mes.device.entity;
 
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
 
import java.util.Date;
 
/**
 * 设备组与设备关联实体类
 * 对应数据库表:device_group_relation
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("device_group_relation")
@ApiModel(value = "DeviceGroupRelation", description = "设备组与设备关联关系")
public class DeviceGroupRelation {
 
    @ApiModelProperty(value = "关联ID", example = "1")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
 
    @ApiModelProperty(value = "设备组ID", example = "1")
    @TableField("group_id")
    private Long groupId;
 
    @ApiModelProperty(value = "设备ID", example = "1")
    @TableField("device_id")
    private Long deviceId;
 
    @ApiModelProperty(value = "设备在组内的优先级:1-最高,10-最低", example = "1")
    @TableField("priority")
    private Integer priority;
 
    @ApiModelProperty(value = "设备在组内的角色:1-主控,2-协作,3-监控", example = "1")
    @TableField("role")
    private Integer role;
 
    @ApiModelProperty(value = "设备在该组中的状态:0-未配置,1-正常,2-故障,3-维护", example = "1")
    @TableField("status")
    private Integer status;
 
    @ApiModelProperty(value = "连接顺序:数值越小越先连接", example = "1")
    @TableField("connection_order")
    private Integer connectionOrder;
 
    @ApiModelProperty(value = "关联描述", example = "主控设备,负责整体协调")
    @TableField("relation_desc")
    private String relationDesc;
 
    @ApiModelProperty(value = "扩展参数JSON", example = "{\"timeout\": 5000, \"retryPolicy\": \"exponential\"}")
    @TableField("extra_params")
    private String extraParams;
 
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;
 
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updatedTime;
 
    @ApiModelProperty(value = "创建人", example = "system")
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;
 
    @ApiModelProperty(value = "更新人", example = "system")
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;
 
    @ApiModelProperty(value = "是否删除:0-否,1-是", example = "0")
    @TableField("is_deleted")
    @TableLogic
    private Integer isDeleted;
 
    // 设备角色枚举
    public static final class Role {
        public static final int CONTROLLER = 1;    // 主控
        public static final int COLLABORATOR = 2;  // 协作
        public static final int MONITOR = 3;       // 监控
    }
 
    // 关联状态枚举
    public static final class Status {
        public static final int UNCONFIGURED = 0;  // 未配置
        public static final int NORMAL = 1;        // 正常
        public static final int FAULT = 2;         // 故障
        public static final int MAINTENANCE = 3;   // 维护
    }
}