diff --git a/server/repository/asset.go b/server/repository/asset.go index f0c847864..2d8107d22 100644 --- a/server/repository/asset.go +++ b/server/repository/asset.go @@ -212,7 +212,7 @@ func (r assetRepository) UpdateAttributes(c context.Context, assetId, protocol s } } - err := r.GetDB(c).Where("asset_id = ?", assetId).Delete(&model.AssetAttribute{}).Error + err := r.GetDB(c).Where("asset_id = ? AND name IN ?", assetId, parameterNames).Delete(&model.AssetAttribute{}).Error if err != nil { return err } diff --git a/server/service/asset.go b/server/service/asset.go index 33378d4d6..b1ccbd443 100644 --- a/server/service/asset.go +++ b/server/service/asset.go @@ -313,7 +313,11 @@ func (s assetService) UpdateById(id string, m maps.Map) error { } if item.AccessGatewayId == "" { - item.AccessGatewayId = "-" + if gatewayId, ok := m["gatewayId"]; ok && gatewayId != "" && gatewayId != "-" { + item.AccessGatewayId = gatewayId.(string) + } else { + item.AccessGatewayId = "-" + } } return s.Transaction(context.Background(), func(ctx context.Context) error {