mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-05-04 17:21:02 -05:00
🎨 Improve database relation field filtering https://github.com/siyuan-note/siyuan/issues/11547
This commit is contained in:
+9
-1
@@ -165,10 +165,18 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, rowID st
|
||||
}
|
||||
}
|
||||
|
||||
if nil != value.Relation && KeyTypeRelation == value.Type && 0 < len(value.Relation.Contents) && nil != filter.Value && KeyTypeRelation == filter.Value.Type &&
|
||||
if nil != value.Relation && KeyTypeRelation == value.Type && nil != filter.Value && KeyTypeRelation == filter.Value.Type &&
|
||||
nil != filter.Value.Relation && 0 < len(filter.Value.Relation.BlockIDs) {
|
||||
// 单独处理关联类型的比较
|
||||
|
||||
// 处理为空和不为空
|
||||
switch filter.Operator {
|
||||
case FilterOperatorIsEmpty:
|
||||
return 0 == len(value.Relation.Contents)
|
||||
case FilterOperatorIsNotEmpty:
|
||||
return 0 != len(value.Relation.Contents)
|
||||
}
|
||||
|
||||
for _, relationValue := range value.Relation.Contents {
|
||||
filterValue := &Value{Type: KeyTypeBlock, Block: &ValueBlock{Content: filter.Value.Relation.BlockIDs[0]}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user