作者 庄敏学

设备采集增加时间字段

@@ -12,6 +12,8 @@ type DeviceCollection struct { @@ -12,6 +12,8 @@ type DeviceCollection struct {
12 DeviceSn string `comment:"设备名"` 12 DeviceSn string `comment:"设备名"`
13 // 设备类型 13 // 设备类型
14 DeviceType string `comment:"设备类型"` 14 DeviceType string `comment:"设备类型"`
  15 + // 采集时间
  16 + CollectionTime time.Time `comment:"采集时间"`
15 // 启动状态 1-启动 0-停止 17 // 启动状态 1-启动 0-停止
16 StartupStatus int64 `comment:"启动状态 1-启动 0-停止" pg:",use_zero"` 18 StartupStatus int64 `comment:"启动状态 1-启动 0-停止" pg:",use_zero"`
17 // 通讯状态 1-通讯正常 0-设备未上电或与采集端通讯故障 19 // 通讯状态 1-通讯正常 0-设备未上电或与采集端通讯故障
@@ -12,6 +12,7 @@ func TransformToDeviceCollectionDomainModelFromPgModels(deviceCollectionModel *m @@ -12,6 +12,7 @@ func TransformToDeviceCollectionDomainModelFromPgModels(deviceCollectionModel *m
12 DeviceSn: deviceCollectionModel.DeviceSn, 12 DeviceSn: deviceCollectionModel.DeviceSn,
13 DeviceType: deviceCollectionModel.DeviceType, 13 DeviceType: deviceCollectionModel.DeviceType,
14 StartupStatus: deviceCollectionModel.StartupStatus, 14 StartupStatus: deviceCollectionModel.StartupStatus,
  15 + CollectionTime: deviceCollectionModel.CreatedAt,
15 ComStatus: deviceCollectionModel.ComStatus, 16 ComStatus: deviceCollectionModel.ComStatus,
16 Values: deviceCollectionModel.Values, 17 Values: deviceCollectionModel.Values,
17 }, nil 18 }, nil
@@ -30,6 +30,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi @@ -30,6 +30,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
30 "work_shop_name", 30 "work_shop_name",
31 "device_sn", 31 "device_sn",
32 "device_type", 32 "device_type",
  33 + "collection_time",
33 "startup_status", 34 "startup_status",
34 "com_status", 35 "com_status",
35 "values", 36 "values",
@@ -53,6 +54,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi @@ -53,6 +54,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
53 &deviceCollection.WorkShopName, 54 &deviceCollection.WorkShopName,
54 &deviceCollection.DeviceSn, 55 &deviceCollection.DeviceSn,
55 &deviceCollection.DeviceType, 56 &deviceCollection.DeviceType,
  57 + &deviceCollection.CollectionTime,
56 &deviceCollection.StartupStatus, 58 &deviceCollection.StartupStatus,
57 &deviceCollection.ComStatus, 59 &deviceCollection.ComStatus,
58 &deviceCollection.Values, 60 &deviceCollection.Values,
@@ -62,6 +64,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi @@ -62,6 +64,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
62 deviceCollection.WorkShopName, 64 deviceCollection.WorkShopName,
63 deviceCollection.DeviceSn, 65 deviceCollection.DeviceSn,
64 deviceCollection.DeviceType, 66 deviceCollection.DeviceType,
  67 + deviceCollection.CollectionTime,
65 deviceCollection.StartupStatus, 68 deviceCollection.StartupStatus,
66 deviceCollection.ComStatus, 69 deviceCollection.ComStatus,
67 deviceCollection.Values, 70 deviceCollection.Values,
@@ -75,6 +78,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi @@ -75,6 +78,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
75 &deviceCollection.WorkShopName, 78 &deviceCollection.WorkShopName,
76 &deviceCollection.DeviceSn, 79 &deviceCollection.DeviceSn,
77 &deviceCollection.DeviceType, 80 &deviceCollection.DeviceType,
  81 + &deviceCollection.CollectionTime,
78 &deviceCollection.StartupStatus, 82 &deviceCollection.StartupStatus,
79 &deviceCollection.ComStatus, 83 &deviceCollection.ComStatus,
80 &deviceCollection.Values, 84 &deviceCollection.Values,
@@ -84,6 +88,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi @@ -84,6 +88,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
84 deviceCollection.WorkShopName, 88 deviceCollection.WorkShopName,
85 deviceCollection.DeviceSn, 89 deviceCollection.DeviceSn,
86 deviceCollection.DeviceType, 90 deviceCollection.DeviceType,
  91 + deviceCollection.CollectionTime,
87 deviceCollection.StartupStatus, 92 deviceCollection.StartupStatus,
88 deviceCollection.ComStatus, 93 deviceCollection.ComStatus,
89 deviceCollection.Values, 94 deviceCollection.Values,