天天看點

List<VO>轉成List<Map>

List<A01090021BatchAddCheckVO> list = (ArrayList<A01090021BatchAddCheckVO>) result.get("list");
if (ValidateUtil.isEmpty(list)) {//上傳成功但list為空會進入這裡
     setMsg("您上傳的檔案内容為空,請核對後重新上傳!", "error");
     setSuccess(false);
     return JSON;
}

List<Map> succList = new ArrayList();   //傳回成功資訊
List<Map> errorList = new ArrayList();     //傳回失敗資訊


//将List<VO>轉成List<Map>
Iterator<A01090021BatchAddCheckVO> iterator = list.iterator();
A01090021BatchAddCheckVO vo;
while (iterator.hasNext()){
        vo = iterator.next();
        succList.add(vo.toMap());
}