*/
@RequestMapping(params = "studentCount")
@ResponseBody
public List<Highchart> studentCount(HttpServletRequest request,String reportType, HttpServletResponse response) {
List<Highchart> list = new ArrayList<Highchart>();
Highchart hc = new Highchart();
StringBuffer sb = new StringBuffer();
sb.append("SELECT className ,count(className) FROM TSStudent group by className");
List userBroswerList = systemService.findByQueryString(sb.toString());
Long count = systemService.getCountForJdbc("SELECT COUNT(1) FROM T_S_student WHERE 1=1");
List lt = new ArrayList();
hc = new Highchart();
hc.setName("班级人数统计分析");
hc.setType(reportType);
Map<String, Object> map;
if (userBroswerList.size() > 0) {
for (Object object : userBroswerList) {
map = new HashMap<String, Object>();
Object[] obj = (Object[]) object;
map.put("name", obj[0]);
map.put("y", obj[1]);
Long groupCount = (Long) obj[1];
Double percentage = 0.0;
if (count != null && count.intValue() != 0) {
percentage = new Double(groupCount)/count;
}
map.put("percentage", percentage*100);
lt.add(map);
}
}
hc.setData(lt);
list.add(hc);
return list;
}