作者 yangfu

fix:字段更名

... ... @@ -140,7 +140,7 @@ func (deviceCollectionService *DeviceCollectionService) DeviceCollection(createD
}
}
newDeviceCollection.Values["Count"] = count
newDeviceCollection.Count = count
newDeviceCollection.ProductCount = count
}
}
// TODO:测试假数据,后期注释掉
... ...
... ... @@ -25,7 +25,7 @@ type DeviceCollection struct {
// 设备数据值
Values map[string]interface{} `json:"values"`
// 数量(字库使用)
Count int `json:"count"`
ProductCount int `json:"productCount"`
// 最后跟新时间(字库使用)
LatestUpdateTime time.Time `json:"latest_update_time"`
}
... ...
... ... @@ -27,7 +27,7 @@ type DeviceCollection struct {
// 删除时间
DeletedAt time.Time `pg:",soft_delete" comment:"删除时间"`
// 数量(字库使用)
Count int `comment:"数量" json:"count"`
ProductCount int `comment:"数量"`
// 最后更新时间(字库使用)
LatestUpdateTime time.Time `comment:"最后更新时间" json:"latest_update_time"`
LatestUpdateTime time.Time `comment:"最后更新时间"`
}
... ...
... ... @@ -15,7 +15,7 @@ func TransformToDeviceCollectionDomainModelFromPgModels(deviceCollectionModel *m
CollectionTime: deviceCollectionModel.CreatedAt,
ComStatus: deviceCollectionModel.ComStatus,
Values: deviceCollectionModel.Values,
Count: deviceCollectionModel.Count,
ProductCount: deviceCollectionModel.ProductCount,
LatestUpdateTime: deviceCollectionModel.LatestUpdateTime,
}, nil
}
... ...
... ... @@ -35,7 +35,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
"startup_status",
"com_status",
"values",
"count",
"product_count",
"latest_update_time",
}
insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields)
... ... @@ -61,7 +61,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
&deviceCollection.StartupStatus,
&deviceCollection.ComStatus,
&deviceCollection.Values,
&deviceCollection.Count,
&deviceCollection.ProductCount,
&deviceCollection.LatestUpdateTime,
),
fmt.Sprintf("INSERT INTO manufacture.device_collections (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
... ... @@ -73,7 +73,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
deviceCollection.StartupStatus,
deviceCollection.ComStatus,
deviceCollection.Values,
deviceCollection.Count,
deviceCollection.ProductCount,
deviceCollection.LatestUpdateTime,
); err != nil {
return deviceCollection, err
... ... @@ -89,7 +89,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
&deviceCollection.StartupStatus,
&deviceCollection.ComStatus,
&deviceCollection.Values,
&deviceCollection.Count,
&deviceCollection.ProductCount,
&deviceCollection.LatestUpdateTime,
),
fmt.Sprintf("UPDATE manufacture.device_collections SET %s WHERE device_collection_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
... ... @@ -101,7 +101,7 @@ func (repository *DeviceCollectionRepository) Save(deviceCollection *domain.Devi
deviceCollection.StartupStatus,
deviceCollection.ComStatus,
deviceCollection.Values,
deviceCollection.Count,
deviceCollection.ProductCount,
deviceCollection.LatestUpdateTime,
deviceCollection.Identify(),
); err != nil {
... ...