把查询的根节点id放到一个list里面,因为后面第二次调用函数的时候参数是一个list
public List<Long> getSid(List<Long> dmali) {
DmaInfoExample ex = new DmaInfoExample();
com.hunankeji.webapp.model.DmaInfoExample.Criteria ca = ex.createCriteria();
ca.andPidIn(dmali);
List<Long> list2 = new ArrayList<Long>();
List<DmaInfo> meterli = dmaInfoDao.selectByExample(ex);
for (DmaInfo dmaInfo : meterli) {
list2.add(dmaInfo.getId());
}
list2.addAll(dmali);
HashSet<Long> set = new HashSet<Long>();
for (Long long1 : list2) {
set.add(long1);
}
List<Long> list = new ArrayList<Long>();
list.addAll(set);
boolean b = list.containsAll(dmali) && dmali.containsAll(list);
if (b) {
return list;
} else {
return getSid(list);
}
}