- 注册时间
- 2018-3-14
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 28
- 精华
- 0
- 帖子
- 0
|
实现类
String sql = "SELECT a.`GRADE_NAME` GRADE_NAME,b.`SUBJECT_NAME` SUBJECT_NAME,SUM(`FRACTION`) sum_fraction,AVG(FRACTION) avg_fraction " +
"FROM `achievement` c " +
"LEFT JOIN `grade` a ON a.`ID` IN (SELECT d.`GRADE_ID` FROM `student` d WHERE d.`ID`=c.`SCHOOL_NUMBER_ID`) " +
"LEFT JOIN `subject` b ON b.`ID` = c.`SUBJECT_ID` GROUP BY a.`GRADE_NAME`,b.`SUBJECT_NAME`";
Query query = null;
List<Map> list = null;
query = session.createSQLQuery(sql);
list = query.list();
return list;
控制器
listachievement = serviceAchievement.AllAchievement();
Map<String, Object> map = new HashMap<String, Object>();
map.put("data", listachievement);
jsonResults= map;
if (listachievement != null) {
return Action.SUCCESS;
}else {
return Action.ERROR;
}
在后台显示的数据是这种方式" data":[["班级1","化学",372.0,74.4]
在前台就不知道怎么去拿取值在页面显示
|
|