Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-12-24 11:11:18 +08:00
commit 67af0fbe9a
2 changed files with 23 additions and 12 deletions

View file

@ -801,6 +801,9 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
}
isSameAv := srcAv.ID == destAv.ID
if isSameAv {
destAv = srcAv
}
for _, keyValues := range srcAv.KeyValues {
if keyValues.Key.ID == operation.KeyID {
@ -849,14 +852,23 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
}
if !destAdded {
destAv.KeyValues = append(destAv.KeyValues, &av.KeyValues{
Key: &av.Key{
ID: operation.BackRelationKeyID,
Name: operation.Name,
Type: av.KeyTypeRelation,
Relation: &av.Relation{AvID: operation.AvID, IsTwoWay: operation.IsTwoWay, BackKeyID: operation.KeyID},
},
})
if operation.IsTwoWay {
destAv.KeyValues = append(destAv.KeyValues, &av.KeyValues{
Key: &av.Key{
ID: operation.BackRelationKeyID,
Name: operation.Name,
Type: av.KeyTypeRelation,
Relation: &av.Relation{AvID: operation.AvID, IsTwoWay: operation.IsTwoWay, BackKeyID: operation.KeyID},
},
})
for _, v := range destAv.Views {
switch v.LayoutType {
case av.LayoutTypeTable:
v.Table.Columns = append(v.Table.Columns, &av.ViewTableColumn{ID: operation.BackRelationKeyID})
}
}
}
}
err = av.SaveAttributeView(srcAv)

View file

@ -600,10 +600,9 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
// 组装列
for _, col := range view.Table.Columns {
key, getErr := attrView.GetKey(col.ID)
if nil != getErr {
err = getErr
return
key, _ := attrView.GetKey(col.ID)
if nil == key {
continue
}
ret.Columns = append(ret.Columns, &av.TableColumn{