如何处理Java多个集合并显示相应数据

源码客栈网 课程设计 1

分别是三个集合

List <oojd> private String oojdent; private String oojd001; private String oojd002; private String oojd003; private String oojd004; List <emtq003> private String xmdkdocno; private String xmdlseq; private String ooag001; private String ooag003; private String role; private String versuccode; private String xmdk030; private String xmdk052; private String emteuc003; List <emtp005> private String versuccode; private Integer versucsdate; private Integer Damt; private Integer Samt; private Integer Tamt; private Integer PD1; private Integer PD2; private Integer PD3; private Integer PS1; private Integer PS2; private Integer PS3;

里边各存储一些数据且没有创建相应的数据表 如何处理才能显示出如下列sql查询的数据 SELECT ooag001,ooag003,A.versuccode,SUM(xmdk052),emteuc003,oojd004,role, CASE role WHEN 'D1' THEN PD1 WHEN 'D2' THEN PD2 WHEN 'D3' THEN PD3 WHEN 'S1' THEN PS1 WHEN 'S2' THEN PS2 WHEN 'S3' THEN PS3 END FROM oojd t,emtq002 03 tmp A LEFT JOIN emtq002 05_tmp B ON A.versuccode=B.versuccode WHERE ooag001 IS NOT NULL AND oojdent= 7 AND oojd001 = xmdk030 GROUP BY ooag001,ooag003,A.versuccode,emteuc003,oojd004,role,PD1,PD2,PD3,PS1,PS2,PS3

回复

共1条回复 我来回复
  • 代码小屋
    这个人很懒,什么都没有留下~
    评论

    执行完SQL 之后用 List <Map> 去接收 然后进行转换 最好使用 java8 的 list.stream().map().collect() map() 在map 中转换

    例如:

    List<oojd> ods = list.stream().map(o -> {
        oojd od = new oojd();
        od.setOojdent(o.get("oojdent"));
        od.setOojd001(o.get("oojd001"));
        od.setOojd002(o.get("oojd002"));
        od.setOojd003(o.get("oojd003"));
        od.setOojd004(o.get("oojd004"));
        return od;
    }).collect(Collectors.toList());
    
    0条评论

发表回复

登录后才能评论