使用java去写一个递归遍历也不是太难,可是oracle sql里面却有更加简单的方法去实现。
例如:经过组别id递归查询组别下的全部员工java
select * from (select * from t_common_group t start with t.id = '001' CONNECT BY PRIOR t.id=t.parent_id) t2 join t_common_agent t3 on t2.id = t3.group_id where t3.state = 'INSERVICE' and t2.enable_flag='Y'
首先经过组别id用CONNECT关联父级id去遍历全部的组别,而后关联员工表获取该组别下的全部员工sql