List map的使用

初始化map Map<String, String> map=new HashMap<String, String>();


String sql="from Tab0 t0 where t0.keytypeid='"+keytypeid+"' and "+

"t0.tabKeys.adddate<'"+(years1+1)+

"-01-01 00:00:00' and t0.tabKeys.adddate>'"+

(years1-1)+"-12-31 23:59:59' and t0.cgName like '%" + keyword + "%' ";

List<Tab0> tab0s=tab0Sercive.getTab0ListByHql(sql);

List<Map<String, String>> tab0lList=new ArrayList<Map<String,String>>();

for(Tab0 tab0 :tab0s){

Map<String, String> map=new HashMap<String, String>();

map.put("randomid", tab0.getRandomid());

map.put("cgName", tab0.getCgName());

//项目类别

map.put("keytypeid",tab0.getKeytypeid().toString());

tab0lList.add(map);

}


你可能感兴趣的:(list,map,使用)