This commit is contained in:
Daniel 2024-04-15 18:00:04 +08:00
parent 58c98ce697
commit 97f8d6c013
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1301,18 +1301,20 @@ func unbindAttributeViewBlock(operation *Operation, tx *Transaction) (err error)
return return
} }
keyValues := attrView.GetBlockKeyValues() for _, keyValues := range attrView.KeyValues {
for _, value := range keyValues.Values { for _, value := range keyValues.Values {
if value.BlockID != operation.ID { if value.BlockID != operation.ID {
continue continue
} }
if av.KeyTypeBlock == value.Type {
unbindBlockAv(tx, operation.AvID, value.BlockID) unbindBlockAv(tx, operation.AvID, value.BlockID)
}
value.BlockID = operation.NextID value.BlockID = operation.NextID
if nil != value.Block { if nil != value.Block {
value.Block.ID = operation.NextID value.Block.ID = operation.NextID
} }
break }
} }
replacedRowID := false replacedRowID := false
@ -2956,14 +2958,17 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
for _, keyValues := range attrView.KeyValues { for _, keyValues := range attrView.KeyValues {
for _, value := range keyValues.Values { for _, value := range keyValues.Values {
if value.BlockID == operation.PreviousID { if value.BlockID != operation.PreviousID {
if value.BlockID != operation.NextID { continue
}
if av.KeyTypeBlock == value.Type && value.BlockID != operation.NextID {
// 换绑 // 换绑
unbindBlockAv(tx, operation.AvID, value.BlockID) unbindBlockAv(tx, operation.AvID, value.BlockID)
} }
value.BlockID = operation.NextID value.BlockID = operation.NextID
if nil != value.Block { if av.KeyTypeBlock == value.Type && nil != value.Block {
value.Block.ID = operation.NextID value.Block.ID = operation.NextID
value.IsDetached = operation.IsDetached value.IsDetached = operation.IsDetached
if !operation.IsDetached { if !operation.IsDetached {
@ -2971,12 +2976,11 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
} }
} }
if !operation.IsDetached { if av.KeyTypeBlock == value.Type && !operation.IsDetached {
bindBlockAv(tx, operation.AvID, operation.NextID) bindBlockAv(tx, operation.AvID, operation.NextID)
} }
} }
} }
}
replacedRowID := false replacedRowID := false
for _, v := range attrView.Views { for _, v := range attrView.Views {