计算方法名调整为find

yun-zuoyi
alwaysfrin 7 years ago
parent 3a86ae3980
commit fc2a6c515c

@ -252,13 +252,13 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
public boolean isExitBySql(String sql); public boolean isExitBySql(String sql);
public double countSumByProperty(String sumPropertyName,String groupByName,String propertyName, Object value); public double findSumByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
public double countSumByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue); public double findSumByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
public double countAvgByProperty(String sumPropertyName,String groupByName,String propertyName, Object value); public double findAvgByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
public double countAvgByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue); public double findAvgByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
public double findMaxByProperty(String sumPropertyName,String groupByName,String propertyName, Object value); public double findMaxByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);

@ -1020,12 +1020,12 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
} }
@Override @Override
public double countSumByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { public double findSumByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) {
return countSumByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); return findSumByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value});
} }
@Override @Override
public double countSumByProperties(String sumPropertyName, String groupByName, String[] paramName, Object[] paramValue) { public double findSumByProperties(String sumPropertyName, String groupByName, String[] paramName, Object[] paramValue) {
if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) { if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) {
StringBuffer sb = new StringBuffer("select sum(:"+sumPropertyName+") from " + persistentClass.getName() + " model where 1=1 "); StringBuffer sb = new StringBuffer("select sum(:"+sumPropertyName+") from " + persistentClass.getName() + " model where 1=1 ");
appendQL(sb,paramName,paramValue); appendQL(sb,paramName,paramValue);
@ -1044,12 +1044,12 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
} }
@Override @Override
public double countAvgByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) { public double findAvgByProperty(String sumPropertyName, String groupByName, String propertyName, Object value) {
return countAvgByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value}); return findAvgByProperties(sumPropertyName,groupByName,new String[]{propertyName},new Object[]{value});
} }
@Override @Override
public double countAvgByProperties(String sumPropertyName, String groupByName, String[] paramName, Object[] paramValue) { public double findAvgByProperties(String sumPropertyName, String groupByName, String[] paramName, Object[] paramValue) {
if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) { if ((paramName != null) && (paramName.length > 0) && (paramValue != null) && (paramValue.length > 0)) {
StringBuffer sb = new StringBuffer("select avg(:"+sumPropertyName+") from " + persistentClass.getName() + " model where 1=1 "); StringBuffer sb = new StringBuffer("select avg(:"+sumPropertyName+") from " + persistentClass.getName() + " model where 1=1 ");
appendQL(sb,paramName,paramValue); appendQL(sb,paramName,paramValue);

Loading…
Cancel
Save