InBlock.gif     Map mailSizeInfo= new HashMap();
InBlock.gif                 try{
InBlock.gif                                String sql = " select count(*) as mailCount,Mail_box_coding as mailCoding from oa_mail    where ISSUANCE_ID =:userId    group by Mail_box_coding";
InBlock.gif                                SQLQuery sqlQuery = (SQLQuery) super.getSession().createSQLQuery(sql).setString( "userId",userId);
InBlock.gif                                List<Object[]> students = sqlQuery.list();
InBlock.gif                                 for (Iterator<Object[]> iterator = students.iterator(); iterator.hasNext();) {
InBlock.gif                                Object[] mailInfo = iterator.next();
InBlock.gif                                             logger.info( "查询出的结果mailInfo    mailCount"+mailInfo[0]+ "mailCoding"+mailInfo[1]);
InBlock.gif                                         mailSizeInfo.put(mailInfo[1],mailInfo[0]);
InBlock.gif                                }
InBlock.gif                } catch(Exception ex){
InBlock.gif                        ex.printStackTrace();
InBlock.gif                         throw new PageJumpException();
InBlock.gif                }
将查询结果放入到map中
到业务逻辑处理中将map中的值取出来,并组装成需要的数据格式
InBlock.gif     String record="";
InBlock.gif                Iterator it = mailSizeInfo.entrySet().iterator();
InBlock.gif                 while (it.hasNext()){
InBlock.gif                        Map.Entry pairs = (Map.Entry)it.next();
InBlock.gif                        logger.info(pairs.getKey() + " = " + pairs.getValue());
InBlock.gif                        String recordNode=pairs.getKey()+ ":'" +pairs.getValue()+ "'";
InBlock.gif                             if (record.length() == 0) {
InBlock.gif                                        record = recordNode;
InBlock.gif                                } else {
InBlock.gif                                        record = record + "," + recordNode;
InBlock.gif                                }
InBlock.gif                }
InBlock.gif                String recordsJson = "{"+record + "}";