diff --git a/base/res_relation.go b/base/res_relation.go index 61a158d..df31f4f 100644 --- a/base/res_relation.go +++ b/base/res_relation.go @@ -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 +}