分别是三个集合
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
自己用三重循环去手写了。。不行可以式式javar的lambda表达式
执行完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());