public List listAccuDtlData(ListaccountingUnitIDs, List mtrlIDs, List energyNodeTypeIDs, List inOutPutIDs, CalendarType reportTypeId, Date beginTime, Date endTime) { if (CollectionUtil.isEmpty(mtrlIDs)) { return new ArrayList<>(); } Boolean energyNodeTypeIDsIsNotEmpty = CollectionUtil.isNotEmpty(energyNodeTypeIDs); Boolean inOutPutIDsIsNotEmpty = CollectionUtil.isNotEmpty(inOutPutIDs); String hql = "select data from AccuDtlData data" + " where data.accuUnit.accuId in ( :accountingUnitIDs )" + " and data.mtrl.id in ( :mtrlIDs )" + " and data.begTime=:beginTime" + " and data.endTime=:endTime"; if (energyNodeTypeIDsIsNotEmpty) { hql += " and data.energyNodeType.id in ( :energyNodeTypeIDs )"; } if (inOutPutIDsIsNotEmpty) { hql += " and data.eoInOutTypeInfo.id in ( :inOutPutIDs )"; } List > sqlParams = new ArrayList<>(); List sqlParam = new ArrayList<>(); sqlParams.add(new SqlParams("accountingUnitIDs", accountingUnitIDs)); sqlParams.add(new SqlParams("mtrlIDs", mtrlIDs)); sqlParam.add(new Condition("beginTime", beginTime)); sqlParam.add(new Condition("endTime", endTime)); if (energyNodeTypeIDsIsNotEmpty) { sqlParams.add(new SqlParams("energyNodeTypeIDs", energyNodeTypeIDs)); } if (inOutPutIDsIsNotEmpty) { sqlParams.add(new SqlParams("inOutPutIDs", inOutPutIDs)); } List resultList = factoryService.selectFactoryHql(hql, sqlParams, sqlParam, AccuDtlData.class); List accuDtlDatas = new ArrayList<>(); if (CollUtil.isNotEmpty(resultList)) { JSONArray jsonArray = new JSONArray(); jsonArray.addAll(resultList); accuDtlDatas = jsonArray.toJavaList(AccuDtlData.class); } return accuDtlDatas;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)