for (String wardCode : WardCodes) { String tempSql=sql+"......."; tempSql+=" ....." + wardCode + "'..."; List<实体类> tempList = createNativeQuery(实体类.class, tempSql); Set set = new HashSet(); List newList = new ArrayList(); for (Iterator it = tempList.iterator(); it.hasNext();) { Object ob= it.next(); if (set.add(ob)) newList.add(ob); } list.clear(); list.addAll(newList); }
循环后 ArrayList查询出来的数据有重复的处理
最新推荐文章于 2023-02-13 10:20:03 发布