Java无限级树(递归)超实用案例

时间:2022-08-30 18:55:12

如下所示:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@Override
 public String getEmployeeBysup(String employeeID) {
   String str="";
   str = getEmployeeBysupSelas(employeeID, str);
   return str.substring(0, str.lastIndexOf(","));
 }
 @Override
 public String getEmployeeBysupSelas(String employeeID, String str) {
   str+="'"+employeeID+"',";
   System.out.println(str);
   String sql="SELECT u.employeeID from tbl_system_user u where supervisorID='"+employeeID+"'";
   List<String> list= jdbcTemplate.queryForList(sql, String.class);
   if(list!=null&&list.size()>0){
     for(int i=0;i<list.size();i++){
       str = getEmployeeBysupSelas(list.get(i), str);
     }
   }
   return str;
 }

以上就是小编为大家带来的Java无限级(递归)超实用案例全部内容了,希望大家多多支持服务器之家~