通过set集合数据不重复的特性去重,最后再转化为数组形式
public JSONArray getSummary(String pk) {
DataTable dataRows=visitPlanDao.getSummary();
DataTable dataRows1=visitPlanDao.getOldSummary(pk);
JSONArray dataList = JSONUtil.dataRows2json(dataRows.getRows(),true);
JSONArray dataList1=JSONUtil.dataRows2json(dataRows1.getRows(),true);
if(dataList1.size()>0){
dataList.addAll(dataList1);
}
Set set=new HashSet();
for (int i=0;i<dataList.size();i++){
set.add(dataList.get(i));
}
dataList=JSONArray.parseArray(set.toString());
return dataList;
}