[feat] 新增 GetJoinResDependencies, 获取 join 依赖关系
This commit is contained in:
parent
d5c3c4704a
commit
9b71c96e61
@ -15,3 +15,28 @@ type ResRelation struct {
|
||||
}
|
||||
|
||||
type GetResRelations func(categoryUuid string) []ResRelation
|
||||
|
||||
// 资源关联依赖
|
||||
func GetJoinResDependencies(code string, items []ResRelation) (dependencies []string) {
|
||||
dependencies = []string{code}
|
||||
|
||||
for {
|
||||
done := true
|
||||
for _, item := range items {
|
||||
if item.Type != "inner" && item.Type != "left" && item.Type != "right" {
|
||||
continue
|
||||
}
|
||||
|
||||
if dependencies[len(dependencies)-1] == item.Code && item.RelationResource != "" {
|
||||
done = false
|
||||
dependencies = append(dependencies, item.RelationResource)
|
||||
}
|
||||
}
|
||||
|
||||
if done {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user