[feat] add base.GetDataIndexPrefixForRelations

This commit is contained in:
what 2023-05-06 15:34:47 +08:00
parent 8826cec03a
commit a8a7318f68

View File

@ -72,3 +72,13 @@ func GetModelJoinsForRelations(model string, items []ResRelation) (result []stri
}
return result
}
func GetDataIndexPrefixForRelations(model string, items []ResRelation) (result []any) {
result = append([]any{model}, result...)
for _, item := range items {
if item.Code == model && (item.Type == "hasMany" || item.Type == "hasOne") {
return append(GetDataIndexPrefixForRelations(item.RelationResource, items), result...)
}
}
return result
}