Merge remote-tracking branch 'origin/main' into lichang

This commit is contained in:
TsMask
2024-05-17 18:07:42 +08:00
28 changed files with 1042 additions and 359 deletions

View File

@@ -1779,21 +1779,21 @@ func XormGetNorthboundCm(neType string, cmResults *[]NorthboundCm) error {
log.Info("XormGetNorthboundCm processing... ")
cmResult := new(NorthboundCm)
rows, err := xEngine.Table("northbound_cm").
rows, err := xEngine.Table("nbi_cm").
Distinct("object_type").
Where("`ne_type` = ?", neType).
Desc("timestamp").
Cols("*").
Rows(cmResult)
if err != nil {
log.Error("Failed to get table northbound_cm:", err)
log.Error("Failed to get table nbi_cm:", err)
return err
}
defer rows.Close()
for rows.Next() {
err := rows.Scan(cmResult)
if err != nil {
log.Error("Failed to get table northbound_cm:", err)
log.Error("Failed to get table nbi_cm:", err)
return err
}
*cmResults = append(*cmResults, *cmResult)
@@ -1805,14 +1805,14 @@ func XormGetNorthboundCmLatestObject(neType, neID, objectType string) (*Northbou
log.Info("XormGetNorthboundCmLatestObject processing... ")
cmResult := new(NorthboundCm)
_, err := xEngine.Table("northbound_cm").
_, err := xEngine.Table("nbi_cm").
Where("`ne_type`=? and `ne_id`=? and `object_type`=?", neType, neID, objectType).
Desc("timestamp").
Cols("*").
Limit(1).
Get(cmResult)
if err != nil {
log.Error("Failed to get table northbound_cm:", err)
log.Error("Failed to get table nbi_cm:", err)
return nil, err
}