首先,多表查询不能用hql(貌似hql就是不支持多表查询,如果可以,希望看到的朋友给个例子)
List list = systemService.findListbySql("SELECT ana.USERID,ANA.SPC_APPLY_NUMBER,SUM(ANA.ANALYZE_RESULT) as sum FROM T_PDMIS_SPCAPPLY_ANALYZE ana RIGHT JOIN T_PDMIS_SPECIAL_APPLY app ON ANA.SPC_APPLY_NUMBER = APP.APP_ID WHERE APP.STATUS='04' AND ANA.SPC_APPLY_NUMBER LIKE '"+month1+"__05%' GROUP BY ANA.USERID,ANA.SPC_APPLY_NUMBER");
Object[] oo1 = (Object[])list.get(0);
String lle=oo1[2].toString(); lle就获取到了0.5
String sqlMonList = "SELECT ST_NO,PRODUCTION_UNIT,"SUM"("NVL"(EXP3,TLD_DOSE)) AS TLD_DOSE FROM T_PDMIS_TLD_REPORT where month='" + month + "' GROUP BY PRODUCTION_UNIT,ST_NO";
List<Map<String, Object>> queryMonreportList = systemService.findForJdbc(sqlMonList.toString(), null);
sum=queryMonreportList.size();
for(Map<String,Object> map:queryMonreportList) {
String onlyId = changMapValue(map.get("ST_NO"));
}
public static String changMapValue(Object obj) {
if (obj != null) {
return obj.toString();
} else {
return "";
}
}