|
|
|
@ -569,7 +569,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
@Override
|
|
|
|
|
public int listCount() {
|
|
|
|
|
try{
|
|
|
|
|
Long count = entityManager.createQuery("select count(distinct model) from " + persistentClass.getName() + " as model",Long.class)
|
|
|
|
|
Long count = entityManager.createQuery("select count(model) from " + persistentClass.getName() + " as model",Long.class)
|
|
|
|
|
.getSingleResult();
|
|
|
|
|
return count == null ? 0 : count.intValue();
|
|
|
|
|
}catch(NoResultException e){
|
|
|
|
@ -580,7 +580,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
@Override
|
|
|
|
|
public int findByPropertyCount(String propertyName, Object value) {
|
|
|
|
|
try{
|
|
|
|
|
String queryString = "select count(distinct model) from " + persistentClass.getName() + " as model where model." + propertyName + "= :" + propertyName;
|
|
|
|
|
String queryString = "select count(model) from " + persistentClass.getName() + " as model where model." + propertyName + "= :" + propertyName;
|
|
|
|
|
Long count = entityManager.createQuery(queryString, Long.class)
|
|
|
|
|
.setParameter(propertyName, value)
|
|
|
|
|
.getSingleResult();
|
|
|
|
@ -612,7 +612,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length);
|
|
|
|
|
}
|
|
|
|
|
StringBuffer queryString = new StringBuffer();
|
|
|
|
|
queryString.append("select count(distinct model) from " + persistentClass.getName() + " as model");
|
|
|
|
|
queryString.append("select count(model) from " + persistentClass.getName() + " as model");
|
|
|
|
|
|
|
|
|
|
int size = propertyNames.length;
|
|
|
|
|
if (size > 0) {
|
|
|
|
@ -755,7 +755,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length);
|
|
|
|
|
}
|
|
|
|
|
StringBuffer queryString = new StringBuffer();
|
|
|
|
|
queryString.append("select count(distinct model) from " + persistentClass.getSimpleName() + " as model where 1=1 ");
|
|
|
|
|
queryString.append("select count(model) from " + persistentClass.getSimpleName() + " as model where 1=1 ");
|
|
|
|
|
|
|
|
|
|
if (hqlWhere != null && hqlWhere.length() > 0) {
|
|
|
|
|
queryString.append(hqlWhere);
|
|
|
|
@ -859,7 +859,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
@Override
|
|
|
|
|
public int findByHqlWhereCount(String hqlWhere) {
|
|
|
|
|
StringBuffer queryString = new StringBuffer();
|
|
|
|
|
queryString.append("select count(distinct model) from " + persistentClass.getSimpleName() + " as model where 1=1 ");
|
|
|
|
|
queryString.append("select count(model) from " + persistentClass.getSimpleName() + " as model where 1=1 ");
|
|
|
|
|
|
|
|
|
|
if (hqlWhere != null && hqlWhere.length() > 0) {
|
|
|
|
|
queryString.append(hqlWhere);
|
|
|
|
@ -875,7 +875,7 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
|
|
|
|
|
@Override
|
|
|
|
|
public int findByHqlWhereCount(DdlPackBean packBean) {
|
|
|
|
|
StringBuffer queryString = new StringBuffer();
|
|
|
|
|
queryString.append("select count(distinct model) from " + persistentClass.getSimpleName()
|
|
|
|
|
queryString.append("select count(model) from " + persistentClass.getSimpleName()
|
|
|
|
|
+ " as model where 1=1 " + packBean.getWhereAppend());
|
|
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery(queryString.toString(), Long.class);
|
|
|
|
|