/**导出到excel
* @param
* @throws Exception
*/
@RequestMapping(value="/excel")
public ModelAndView exportExcel() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"导出Entity到excel");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;}
ModelAndView mv = new ModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
Map<String,Object> dataMap = new HashMap<String,Object>();
List<String> titles = new ArrayList<String>();
titles.add("表内id"); //1
titles.add("姓名"); //2
titles.add("实体类型"); //3
titles.add("topicid"); //4
titles.add("评论"); //5
// titles.add("0/1,1:已删"); //6
dataMap.put("titles", titles);
List<PageData> varOList = entityService.listAll(pd);
List<PageData> varList = new ArrayList<PageData>();
for(int i=0;i<varOList.size();i++){
PageData vpd = new PageData();
vpd.put("var1", varOList.get(i).get("ID").toString()); //1
vpd.put("var2", varOList.get(i).getString("NAME")); //2
vpd.put("var3", varOList.get(i).getString("ENTITYTYPE")); //3
vpd.put("var4", varOList.get(i).get("TOPICID").toString()); //4
vpd.put("var5", varOList.get(i).getString("COMMENTS")); //5
// vpd.put("var6", varOList.get(i).getString("DEL")); //6
varList.add(vpd);
}
dataMap.put("varList", varList);
ObjectExcelView erv = new ObjectExcelView();
mv = new ModelAndView(erv,dataMap);
return mv;
}
if(varOList.get(i).get("TOPICID")!=null){
vpd.put("var4", varOList.get(i).get("TOPICID").toString()); //4
}
varOList.get(i).get("TOPICID") 返回值判一下空.
话说在哪里判断呀