List<AiPart> aiPartList = aiPartMapper.getAiPartsByCaseId(caseId);

        /**
         * 拼接成 List<InjuredReturnResult2>形式,一张图片对应哪几个配件。
         */
        List<InjuredReturnResult2> injuredReturnResult2List = new ArrayList<>();

        Map<String, List<AiPart>> groupBy2 = new HashMap<>();
        List<AiPart> tempList = null;
        for(AiPart aiPart : aiPartList ) {
            if(groupBy2.containsKey(aiPart.getImageUrl())) {
                tempList = groupBy2.get(aiPart.getImageUrl());
                tempList.add(aiPart);
            } else {
                // 否则,第一次先构造一个list,在存入map
                tempList = new ArrayList<>();
                tempList.add(aiPart);
                groupBy2.put(aiPart.getImageUrl(), tempList);
            }
        }
System.out.println("转换参数:"+JSON.toJSONString(groupBy2));

  

posted on 2020-04-02 10:39  lazyli  阅读(5767)  评论(0编辑  收藏  举报