|
@@ -111,6 +111,34 @@ func traverse(tree *Tree, node TreeNode) bool { |
|
@@ -111,6 +111,34 @@ func traverse(tree *Tree, node TreeNode) bool { |
111
|
return match
|
111
|
return match
|
112
|
}
|
112
|
}
|
113
|
|
113
|
|
|
|
114
|
+// 返回tree下的所有子部门 (如果节点是组织,跳过)
|
|
|
115
|
+func (tree *Tree) AllSubDepartment(node TreeNode) []TreeNode {
|
|
|
116
|
+ treeNode := tree.find(node)
|
|
|
117
|
+ if treeNode == nil {
|
|
|
118
|
+ return []TreeNode{}
|
|
|
119
|
+ }
|
|
|
120
|
+ var stack []*Tree
|
|
|
121
|
+ stack = append(stack, treeNode)
|
|
|
122
|
+ var res []TreeNode
|
|
|
123
|
+ for {
|
|
|
124
|
+ if len(stack) == 0 {
|
|
|
125
|
+ break
|
|
|
126
|
+ }
|
|
|
127
|
+ pop := stack[0]
|
|
|
128
|
+ stack = stack[1:]
|
|
|
129
|
+ /***特殊处理***/
|
|
|
130
|
+ if org, ok := pop.Node.(*Org); ok && fmt.Sprintf("%v", org.OrgId) != treeNode.Node.ID() {
|
|
|
131
|
+ if org.IsOrg == IsOrgFlag {
|
|
|
132
|
+ continue
|
|
|
133
|
+ }
|
|
|
134
|
+ }
|
|
|
135
|
+ /***特殊处理***/
|
|
|
136
|
+ stack = append(stack, pop.Nodes...)
|
|
|
137
|
+ res = append(res, pop.Node)
|
|
|
138
|
+ }
|
|
|
139
|
+ return res
|
|
|
140
|
+}
|
|
|
141
|
+
|
114
|
// Int64String 1 -> "1" 1->1
|
142
|
// Int64String 1 -> "1" 1->1
|
115
|
type Int64String int64
|
143
|
type Int64String int64
|
116
|
|
144
|
|