Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-10-11 16:46:34 +08:00
parent 4a7e740801
commit c4b52b6aee
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -157,10 +157,6 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
// 单独处理汇总 // 单独处理汇总
if nil != value.Rollup && KeyTypeRollup == value.Type && nil != filter.Value && KeyTypeRollup == filter.Value.Type && nil != filter.Value.Rollup { if nil != value.Rollup && KeyTypeRollup == value.Type && nil != filter.Value && KeyTypeRollup == filter.Value.Type && nil != filter.Value.Rollup {
if 1 > len(filter.Value.Rollup.Contents) {
return true
}
key, _ := attrView.GetKey(value.KeyID) key, _ := attrView.GetKey(value.KeyID)
if nil == key { if nil == key {
return false return false
@ -200,10 +196,16 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
if FilterOperatorIsEmpty == filter.Operator { if FilterOperatorIsEmpty == filter.Operator {
return true return true
} else if FilterOperatorIsNotEmpty == filter.Operator { } else if FilterOperatorIsNotEmpty == filter.Operator {
return false if 0 < len(value.Rollup.Contents) {
return true
}
} }
} }
if 1 > len(filter.Value.Rollup.Contents) {
return true
}
for _, content := range value.Rollup.Contents { for _, content := range value.Rollup.Contents {
if content.filter(filter.Value.Rollup.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) { if content.filter(filter.Value.Rollup.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) {
return true return true
@ -220,6 +222,10 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
} }
} }
if 1 > len(filter.Value.Rollup.Contents) {
return true
}
for _, content := range value.Rollup.Contents { for _, content := range value.Rollup.Contents {
if !content.filter(filter.Value.Rollup.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) { if !content.filter(filter.Value.Rollup.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) {
return false return false
@ -235,6 +241,10 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
} }
} }
if 1 > len(filter.Value.Rollup.Contents) {
return true
}
for _, content := range value.Rollup.Contents { for _, content := range value.Rollup.Contents {
if content.filter(filter.Value.Rollup.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) { if content.filter(filter.Value.Rollup.Contents[0], filter.RelativeDate, filter.RelativeDate2, filter.Operator) {
return false return false
@ -282,15 +292,16 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
// 单独处理资源 // 单独处理资源
if nil != value.MAsset && KeyTypeMAsset == value.Type && nil != filter.Value && KeyTypeMAsset == filter.Value.Type { if nil != value.MAsset && KeyTypeMAsset == value.Type && nil != filter.Value && KeyTypeMAsset == filter.Value.Type {
if 1 > len(filter.Value.MAsset) {
return true
}
key, _ := attrView.GetKey(value.KeyID) key, _ := attrView.GetKey(value.KeyID)
if nil == key { if nil == key {
return false return false
} }
var filterContent string
if 1 <= len(filter.Value.MAsset) {
filterContent = filter.Value.MAsset[0].Content
}
switch filter.Qualifier { switch filter.Qualifier {
case FilterQuantifierUndefined, FilterQuantifierAny: case FilterQuantifierUndefined, FilterQuantifierAny:
if 1 > len(value.MAsset) { // 说明资源字段为空 if 1 > len(value.MAsset) { // 说明资源字段为空
@ -304,12 +315,12 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
for _, asset := range value.MAsset { for _, asset := range value.MAsset {
switch asset.Type { switch asset.Type {
case AssetTypeFile: case AssetTypeFile:
if filterTextContent(filter.Operator, asset.Name, filter.Value.MAsset[0].Content) || if filterTextContent(filter.Operator, asset.Name, filterContent) ||
filterTextContent(filter.Operator, asset.Content, filter.Value.MAsset[0].Content) { filterTextContent(filter.Operator, asset.Content, filterContent) {
return true return true
} }
case AssetTypeImage: case AssetTypeImage:
if filterTextContent(filter.Operator, asset.Content, filter.Value.MAsset[0].Content) { if filterTextContent(filter.Operator, asset.Content, filterContent) {
return true return true
} }
} }
@ -326,12 +337,12 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
for _, asset := range value.MAsset { for _, asset := range value.MAsset {
switch asset.Type { switch asset.Type {
case AssetTypeFile: case AssetTypeFile:
if !filterTextContent(filter.Operator, asset.Name, filter.Value.MAsset[0].Content) && if !filterTextContent(filter.Operator, asset.Name, filterContent) &&
!filterTextContent(filter.Operator, asset.Content, filter.Value.MAsset[0].Content) { !filterTextContent(filter.Operator, asset.Content, filterContent) {
return false return false
} }
case AssetTypeImage: case AssetTypeImage:
if !filterTextContent(filter.Operator, asset.Content, filter.Value.MAsset[0].Content) { if !filterTextContent(filter.Operator, asset.Content, filterContent) {
return false return false
} }
} }
@ -350,17 +361,17 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
switch asset.Type { switch asset.Type {
case AssetTypeFile: case AssetTypeFile:
if "" != strings.TrimSpace(asset.Name) { if "" != strings.TrimSpace(asset.Name) {
if filterTextContent(filter.Operator, asset.Name, filter.Value.MAsset[0].Content) { if filterTextContent(filter.Operator, asset.Name, filterContent) {
return false return false
} }
} }
if "" != strings.TrimSpace(asset.Content) { if "" != strings.TrimSpace(asset.Content) {
if filterTextContent(filter.Operator, asset.Content, filter.Value.MAsset[0].Content) { if filterTextContent(filter.Operator, asset.Content, filterContent) {
return false return false
} }
} }
case AssetTypeImage: case AssetTypeImage:
if filterTextContent(filter.Operator, asset.Content, filter.Value.MAsset[0].Content) { if filterTextContent(filter.Operator, asset.Content, filterContent) {
return false return false
} }
} }