主键 | 上级id | 节点路径 |
id | pid | node_path |
1 | 0 | 0-1 |
2 | 1 | 0-1-2 |
3 | 2 | 0-1-2-3 |
node_path text ut8编码 添加普通索引,长度1000
查询下属团队:select * from t where node_path like "mynodepath%";
查询所有上级:select node_path from t where id = myid;
主键 | 上级id | 节点路径 |
id | pid | node_path |
1 | 0 | 0-1 |
2 | 1 | 0-1-2 |
3 | 2 | 0-1-2-3 |
node_path text ut8编码 添加普通索引,长度1000
查询下属团队:select * from t where node_path like "mynodepath%";
查询所有上级:select node_path from t where id = myid;