[feat] add base.GetDataIndexPrefixForRelations
This commit is contained in:
parent
8826cec03a
commit
a8a7318f68
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user