查询结果list,循环判断不符合的删除,只显示符合条件的数据,没想到好多方法;下面是自己笨方法实现
//返回结果集
List<Pollution> dmList = mapper.getDmData(params);
if(dmList !=null && dmList.size()>0){
List<Pollution> lst = new ArrayList<Pollution>();
for (Pollution pollution : dmList) {
List<Pollution> yzList = mapper.getFactorData(pollution.getResultId());
if(yzList != null && yzList.size()>0){
pollution.setList(yzList);
}else {
lst.add(pollution);
}
}
dmList.removeAll(lst);
}
return dmList;