mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 08:30:42 +02:00
🎨 Improve database field default filling https://github.com/siyuan-note/siyuan/issues/11966
This commit is contained in:
parent
bb989bcb35
commit
9c99c6f8ef
1 changed files with 7 additions and 7 deletions
|
@ -79,22 +79,22 @@ func getAttrViewAddingBlockDefaultValues(attrView *av.AttributeView, view, group
|
||||||
filterKeyIDs[f.Column] = true
|
filterKeyIDs[f.Column] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对库中存在模板字段的情况进行处理
|
// 对库中存在模板字段和汇总字段的情况进行处理(尽量从临近项获取新值,获取不到的话直接返回)
|
||||||
existTemplateField := false
|
existSpecialField := false
|
||||||
for _, keyValues := range attrView.KeyValues {
|
for _, keyValues := range attrView.KeyValues {
|
||||||
if av.KeyTypeTemplate == keyValues.Key.Type {
|
if av.KeyTypeTemplate == keyValues.Key.Type || av.KeyTypeRollup == keyValues.Key.Type {
|
||||||
existTemplateField = true
|
existSpecialField = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if existTemplateField {
|
if existSpecialField {
|
||||||
if nil != nearItem {
|
if nil != nearItem {
|
||||||
// 存在模板字段且存在临近项时从临近项获取新值
|
// 存在临近项时从临近项获取新值
|
||||||
for _, keyValues := range attrView.KeyValues {
|
for _, keyValues := range attrView.KeyValues {
|
||||||
newValue := getNewValueByNearItem(nearItem, keyValues.Key, addingBlockID)
|
newValue := getNewValueByNearItem(nearItem, keyValues.Key, addingBlockID)
|
||||||
ret[keyValues.Key.ID] = newValue
|
ret[keyValues.Key.ID] = newValue
|
||||||
}
|
}
|
||||||
} else { // 存在模板字段但不存在临近项时不生成任何新值
|
} else { // 不存在临近项时不生成任何新值
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue