SQL语句为:
select substr(a.paydate,1,6) as paydate,sum(a.materialamt) as amt from (select * from db.tbcimt3 where APPID=‘INJJ47‘ AND CIMP1NO=‘18SJ6203‘ and PAYKIND=‘F‘ ) a group by substr(a.paydate,1,6) order by substr(a.paydate,1,6)
这条SQL查询出来的数据用map数组接收,在func中对map数组遍历取出对应的月份信息和费用信息,add到list中,数组有多大,就创建几个list,将每个list依次add到dataList中,最后将dataList中的数据打印到excel中,代码如下:
Map map = new HashMap(); map.put("compid", dsCom.companyId); map.put("cimp1no", cimp1.getCimp1no()); map.put("cimp1name", cimp1.getProjectname()); map.put("sdate", cimp1.getEstimatestartdate()); map.put("edate", cimp1.getEstimatefinishdate()); dxjiTemplateMerger merger = dxjcMergerFactory.buildTemplateMerger(); merger.setMergingDataMap(map); File rpt = merger.mergeSimpleList("cia", "ciacw6.xls", dataList);
原文地址:https://www.cnblogs.com/zeevy/p/12118328.html
时间: 2024-11-09 04:45:56