|
|
|
@ -1415,12 +1415,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
setParameter(query,paramName,paramValue);
|
|
|
|
|
|
|
|
|
|
double sumResult = 0.0;
|
|
|
|
|
List<?> objList = query.getResultList();
|
|
|
|
|
if(objList.size() > 0){
|
|
|
|
|
sumResult = Double.parseDouble(objList.iterator().next().toString());
|
|
|
|
|
}
|
|
|
|
|
return sumResult;
|
|
|
|
|
return getNumberByResultList(query.getResultList());
|
|
|
|
|
}else{
|
|
|
|
|
throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue);
|
|
|
|
|
}
|
|
|
|
@ -1444,12 +1439,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
setParameter(query,paramName,paramValue);
|
|
|
|
|
|
|
|
|
|
double sumResult = 0.0;
|
|
|
|
|
List<?> objList = query.getResultList();
|
|
|
|
|
if(objList.size() > 0){
|
|
|
|
|
sumResult = Double.parseDouble(objList.iterator().next().toString());
|
|
|
|
|
}
|
|
|
|
|
return sumResult;
|
|
|
|
|
return getNumberByResultList(query.getResultList());
|
|
|
|
|
}else{
|
|
|
|
|
throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue);
|
|
|
|
|
}
|
|
|
|
@ -1472,12 +1462,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
setParameter(query,paramName,paramValue);
|
|
|
|
|
|
|
|
|
|
double sumResult = 0.0;
|
|
|
|
|
List<?> objList = query.getResultList();
|
|
|
|
|
if(objList.size() > 0){
|
|
|
|
|
sumResult = Double.parseDouble(objList.iterator().next().toString());
|
|
|
|
|
}
|
|
|
|
|
return sumResult;
|
|
|
|
|
return getNumberByResultList(query.getResultList());
|
|
|
|
|
}else{
|
|
|
|
|
throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue);
|
|
|
|
|
}
|
|
|
|
@ -1501,14 +1486,24 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
Query query = entityManager.createQuery(sb.toString());
|
|
|
|
|
setParameter(query,paramName,paramValue);
|
|
|
|
|
|
|
|
|
|
double sumResult = 0.0;
|
|
|
|
|
List<?> objList = query.getResultList();
|
|
|
|
|
if(objList.size() > 0){
|
|
|
|
|
sumResult = Double.parseDouble(objList.iterator().next().toString());
|
|
|
|
|
}
|
|
|
|
|
return sumResult;
|
|
|
|
|
return getNumberByResultList(query.getResultList());
|
|
|
|
|
}else{
|
|
|
|
|
throw new IllegalArgumentException("sum查询错误!paramName:" + paramName + ",paramValue:" + paramValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//从结果集中获取数字转换
|
|
|
|
|
public double getNumberByResultList(List objList){
|
|
|
|
|
double num = 0.0;
|
|
|
|
|
if(objList != null && objList.size() > 0){
|
|
|
|
|
if(objList.get(0) != null){
|
|
|
|
|
try {
|
|
|
|
|
num = Double.parseDouble(objList.get(0).toString());
|
|
|
|
|
}catch(NumberFormatException ne){
|
|
|
|
|
LOGGER.error("数字转换出错!",ne);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|