|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package cn.estsh.i3plus.pojo.base.jpa.dao;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
|
|
import org.springframework.data.repository.NoRepositoryBean;
|
|
|
|
@ -39,6 +40,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行ql语句
|
|
|
|
|
* hql写法:update obj set name = ?,问号舒徐需要和list顺序一致
|
|
|
|
|
* @param qlString 基于jpa标准的ql语句
|
|
|
|
|
* @param values ql中的T参数值,单个参数值或者多个参数值
|
|
|
|
|
* @return 返回执行后受影响的数据个数
|
|
|
|
@ -47,6 +49,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行ql语句
|
|
|
|
|
* hql写法:update obj set name = :name
|
|
|
|
|
* @param qlString 基于jpa标准的ql语句
|
|
|
|
|
* @param params key表示ql中参数变量名,value表示该参数变量值
|
|
|
|
|
* @return 返回执行后受影响的数据个数
|
|
|
|
@ -55,6 +58,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行ql语句,可以是更新或者删除操作
|
|
|
|
|
* hql写法:update obj set name = ?,问号舒徐需要和list顺序一致
|
|
|
|
|
* @param qlString 基于jpa标准的ql语句
|
|
|
|
|
* @param values ql中的T参数值
|
|
|
|
|
* @return 返回执行后受影响的数据个数
|
|
|
|
@ -65,11 +69,11 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
/**
|
|
|
|
|
* 强删除
|
|
|
|
|
*/
|
|
|
|
|
public void deleteById(ID id);
|
|
|
|
|
public int deleteByProperty(String propName, Object propValue);
|
|
|
|
|
public int deleteByPropertyIn(String propName, Object[] propValues);
|
|
|
|
|
public int deleteByIds(ID[] ids);
|
|
|
|
|
public int deleteByProperties(String[] propNames, Object[] objValues);
|
|
|
|
|
void deleteById(ID id);
|
|
|
|
|
int deleteByProperty(String propName, Object propValue);
|
|
|
|
|
int deleteByPropertyIn(String propName, Object[] propValues);
|
|
|
|
|
int deleteByIds(ID[] ids);
|
|
|
|
|
int deleteByProperties(String[] propNames, Object[] objValues);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过多单属性进行单个值更新
|
|
|
|
@ -78,7 +82,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* @param propertyName
|
|
|
|
|
* @param propertyValue
|
|
|
|
|
*/
|
|
|
|
|
public int updateByProperties(String conditionName, Object conditionValue, String propertyName, Object propertyValue);
|
|
|
|
|
int updateByProperties(String conditionName, Object conditionValue, String propertyName, Object propertyValue);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过单个属性进行多个值更新
|
|
|
|
@ -87,7 +91,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* @param propertyName
|
|
|
|
|
* @param propertyValue
|
|
|
|
|
*/
|
|
|
|
|
public int updateByProperties(String conditionName, Object conditionValue, String[] propertyName, Object[] propertyValue);
|
|
|
|
|
int updateByProperties(String conditionName, Object conditionValue, String[] propertyName, Object[] propertyValue);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过多个属性进行单个值更新
|
|
|
|
@ -96,7 +100,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* @param propertyName
|
|
|
|
|
* @param propertyValue
|
|
|
|
|
*/
|
|
|
|
|
public int updateByProperties(String[] conditionName, Object[] conditionValue, String propertyName, Object propertyValue);
|
|
|
|
|
int updateByProperties(String[] conditionName, Object[] conditionValue, String propertyName, Object propertyValue);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过多个属性进行多个值更新
|
|
|
|
@ -105,7 +109,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* @param propertyName 更新属性名称
|
|
|
|
|
* @param propertyValue 更新属性值
|
|
|
|
|
*/
|
|
|
|
|
public int updateByProperties(String[] conditionName, Object[] conditionValue, String[] propertyName, Object[] propertyValue);
|
|
|
|
|
int updateByProperties(String[] conditionName, Object[] conditionValue, String[] propertyName, Object[] propertyValue);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据 hqlWhere 批量修改制定字段
|
|
|
|
@ -114,7 +118,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* @param propertyValue 修改后的值
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int updateByHqlWhere(String hqlWhere,String propertyName, Object propertyValue);
|
|
|
|
|
int updateByHqlWhere(String hqlWhere,String propertyName, Object propertyValue);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量修改数据熟悉
|
|
|
|
@ -123,98 +127,135 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* @param propertyValue 修改后的值
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int updateByHqlWhere(String hqlWhere,String[] propertyName, Object[] propertyValue);
|
|
|
|
|
int updateByHqlWhere(String hqlWhere,String[] propertyName, Object[] propertyValue);
|
|
|
|
|
|
|
|
|
|
public T getById(long id);
|
|
|
|
|
T getById(long id);
|
|
|
|
|
|
|
|
|
|
public List<T> list();
|
|
|
|
|
List<T> list();
|
|
|
|
|
|
|
|
|
|
public List<T> list(final String hql);
|
|
|
|
|
List<T> list(final String hql);
|
|
|
|
|
|
|
|
|
|
public List<T> listPager(Pager pager);
|
|
|
|
|
List<T> listPager(Pager pager);
|
|
|
|
|
|
|
|
|
|
public List<T> findByPage(final String hql, final int offset,final int pageSize);
|
|
|
|
|
List<T> findByPage(final DdlPackBean packBean, final int offset, final int pageSize);
|
|
|
|
|
|
|
|
|
|
public List<T> findByPage(final String hql, final Object[] values, final int offset, final int pageSize);
|
|
|
|
|
/**
|
|
|
|
|
* @param hql hql入参需要用问号代替
|
|
|
|
|
* @param values 按照入参问号的顺序进行赋值
|
|
|
|
|
* @param offset
|
|
|
|
|
* @param pageSize
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
List<T> findByPage(final String hql, final Object[] values, final int offset, final int pageSize);
|
|
|
|
|
|
|
|
|
|
List<T> findByProperty(String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
List<T> findByProperty(String[] propertyNames, Object[] values);
|
|
|
|
|
|
|
|
|
|
List<T> findByProperty(String propertyName, Object value,String orderByStuff);
|
|
|
|
|
|
|
|
|
|
public List<T> findByProperty(String propertyName, Object value);
|
|
|
|
|
List<T> findByProperty(String[] propertyNames, Object[] values,String orderByStuff);
|
|
|
|
|
|
|
|
|
|
public List<T> findByProperty(String[] propertyNames, Object[] values);
|
|
|
|
|
T getByProperty(String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public List<T> findByProperty(String propertyName, Object value,String orderByStuff);
|
|
|
|
|
T getByProperty(String[] propertyNames, Object[] values);
|
|
|
|
|
|
|
|
|
|
public List<T> findByProperty(String[] propertyNames, Object[] values,String orderByStuff);
|
|
|
|
|
int listCount();
|
|
|
|
|
|
|
|
|
|
public T getByProperty(String propertyName, Object value);
|
|
|
|
|
int findByPropertyCount(String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public T getByProperty(String[] propertyNames, Object[] values);
|
|
|
|
|
int findByPropertyCount(String[] propertyNames, Object[] values);
|
|
|
|
|
|
|
|
|
|
public int listCount();
|
|
|
|
|
List<T> findByPropertyPage(String propertyName, Object value,String orderByStuff,Pager pager);
|
|
|
|
|
|
|
|
|
|
public int findByPropertyCount(String propertyName, Object value);
|
|
|
|
|
List<T> findByPropertyPage(String[] propertyNames, Object[] values,String orderByStuff,Pager pager);
|
|
|
|
|
|
|
|
|
|
public int findByPropertyCount(String[] propertyNames, Object[] values);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<T> findByHql(String hql);
|
|
|
|
|
|
|
|
|
|
public List<T> findByPropertyPage(String propertyName, Object value,String orderByStuff,Pager pager);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<T> findByHqlWhere(String hqlWhere);
|
|
|
|
|
|
|
|
|
|
public List<T> findByPropertyPage(String[] propertyNames, Object[] values,String orderByStuff,Pager pager);
|
|
|
|
|
List<T> findByHqlWhere(DdlPackBean packBean);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHql(String hql);
|
|
|
|
|
List<T> findByHqlWhere(String hqlWhere,String[] propertyNames, Object[] values,String orderByStuff);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlWhere(String hqlWhere);
|
|
|
|
|
int findByHqlWhereCount(String hqlWhere,String[] propertyNames, Object[] values);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlWhere(String hqlWhere,String[] propertyNames, Object[] values,String orderByStuff);
|
|
|
|
|
List<T> findByHqlWherePage(String hqlWhere, Pager pager,String[] propertyNames, Object[] values,String orderByStuff);
|
|
|
|
|
|
|
|
|
|
public int findByHqlWhereCount(String hqlWhere,String[] propertyNames, Object[] values);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<T> findByHqlWherePage(String hqlWhere, Pager pager);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlWherePage(String hqlWhere, Pager pager,String[] propertyNames, Object[] values,String orderByStuff);
|
|
|
|
|
List<T> findByHqlWherePage(DdlPackBean packBean, Pager pager);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlWherePage(String hqlWhere, Pager pager);
|
|
|
|
|
@Deprecated
|
|
|
|
|
int findByHqlWhereCount(String hqlWhere);
|
|
|
|
|
|
|
|
|
|
public int findByHqlWhereCount(String hqlWhere);
|
|
|
|
|
int findByHqlWhereCount(DdlPackBean packBean);
|
|
|
|
|
|
|
|
|
|
public int findByHqlCount(String hql);
|
|
|
|
|
int findByHqlCount(String hql);
|
|
|
|
|
|
|
|
|
|
public int findByHqlCount(String hql,String[] paramName,Object[] paramValue);
|
|
|
|
|
int findByHqlCount(String hql,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlPage(String hql, Pager pager);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<T> findByHqlPage(String hql, Pager pager);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlPage(String hql, Pager pager,String[] paramName,Object[] paramValue);
|
|
|
|
|
List<T> findByHqlPage(DdlPackBean packBean, Pager pager);
|
|
|
|
|
|
|
|
|
|
public List findBySql(String sql);
|
|
|
|
|
List<T> findByHqlPage(String hql, Pager pager,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public List<?> findBySql(String sql,Class entity);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List findBySql(String sql);
|
|
|
|
|
|
|
|
|
|
public List findBySqlPage(String sql,Pager pager);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<?> findBySql(String sql,Class entity);
|
|
|
|
|
|
|
|
|
|
public List<?> findBySqlPage(String sql,Class entity,Pager pager);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List findBySqlPage(String sql,Pager pager);
|
|
|
|
|
|
|
|
|
|
public int executeSql(String sql);
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<?> findBySqlPage(String sql,Class entity,Pager pager);
|
|
|
|
|
|
|
|
|
|
public int findBySqlCount(String sql);
|
|
|
|
|
@Deprecated
|
|
|
|
|
int executeSql(String sql);
|
|
|
|
|
|
|
|
|
|
public double findBySqlSumDouble(String sql,String columnName);
|
|
|
|
|
@Deprecated
|
|
|
|
|
int findBySqlCount(String sql);
|
|
|
|
|
|
|
|
|
|
public double findByHqlDouble(String hql);
|
|
|
|
|
@Deprecated
|
|
|
|
|
double findBySqlSumDouble(String sql,String columnName);
|
|
|
|
|
|
|
|
|
|
public long findByHqlLong(String hql);
|
|
|
|
|
@Deprecated
|
|
|
|
|
double findByHqlDouble(String hql);
|
|
|
|
|
|
|
|
|
|
public List<T> findByHqlTopWhere(String hqlWhere,int topNum);
|
|
|
|
|
double findByHqlDouble(DdlPackBean packBean);
|
|
|
|
|
|
|
|
|
|
public List<T> findColumnsByHql(String hql, String hqlWhere, String orderByStuff, Pager pager);
|
|
|
|
|
@Deprecated
|
|
|
|
|
long findByHqlLong(String hql);
|
|
|
|
|
|
|
|
|
|
long findByHqlLong(DdlPackBean packBean);
|
|
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<T> findByHqlTopWhere(String hqlWhere,int topNum);
|
|
|
|
|
|
|
|
|
|
List<T> findByHqlTopWhere(DdlPackBean packBean,int topNum);
|
|
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
|
List<T> findColumnsByHql(String hql, String hqlWhere, String orderByStuff, Pager pager);
|
|
|
|
|
|
|
|
|
|
/********************** 多表联查,返回Object[]数组根据hql查询翻页信息 开始 ****************************/
|
|
|
|
|
public List<Object[]> findByHqlObjects(String hql);
|
|
|
|
|
List<Object[]> findByHqlObjects(String hql);
|
|
|
|
|
|
|
|
|
|
public List<Object[]> findByHqlObjects(String hql,String[] paramName,Object[] paramValue);
|
|
|
|
|
List<Object[]> findByHqlObjects(String hql,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public List<Object[]> findByHqlPageObjects(String hql, Pager pager);
|
|
|
|
|
List<Object[]> findByHqlPageObjects(String hql, Pager pager);
|
|
|
|
|
|
|
|
|
|
public List<Object[]> findByHqlPageObjects(String hql, Pager pager,String[] paramName,Object[] paramValue);
|
|
|
|
|
List<Object[]> findByHqlPageObjects(String hql, Pager pager,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public List<Object[]> findBySqlObjList(String sql);
|
|
|
|
|
List<Object[]> findBySqlObjList(String sql);
|
|
|
|
|
|
|
|
|
|
public List<Object[]> findBySqlObjListByPager(String sql,Pager pager);
|
|
|
|
|
List<Object[]> findBySqlObjListByPager(String sql,Pager pager);
|
|
|
|
|
|
|
|
|
|
/****************** 部分业务处理 *******************/
|
|
|
|
|
|
|
|
|
@ -222,49 +263,52 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
|
|
|
|
|
* 弱删除
|
|
|
|
|
* @return count
|
|
|
|
|
*/
|
|
|
|
|
public int deleteWeaklyById(ID id,String username);
|
|
|
|
|
public int deleteWeaklyByIds(Long[] ids,String username) ;
|
|
|
|
|
public int deleteWeaklyByProperty(String propName, Object propValue,String username);
|
|
|
|
|
public int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username);
|
|
|
|
|
public int deleteWeaklyByProperties(String[] propNames, Object[] objValues,String username);
|
|
|
|
|
int deleteWeaklyById(ID id,String username);
|
|
|
|
|
int deleteWeaklyByIds(Long[] ids,String username) ;
|
|
|
|
|
int deleteWeaklyByProperty(String propName, Object propValue,String username);
|
|
|
|
|
int deleteWeaklyByPropertyIn(String propName, Object[] propValues,String username);
|
|
|
|
|
int deleteWeaklyByProperties(String[] propNames, Object[] objValues,String username);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新启用禁用
|
|
|
|
|
* @return count
|
|
|
|
|
*/
|
|
|
|
|
public int updateValidStatusById(ID id,int status,String username);
|
|
|
|
|
public int updateValidStatusByIds(Long[] ids,int status,String username) ;
|
|
|
|
|
public int updateValidStatusByProperty(String propName, Object propValue,int status,String username);
|
|
|
|
|
public int updateValidStatusByPropertyIn(String propName, Object[] propValues,int status,String username);
|
|
|
|
|
public int updateValidStatusByProperties(String[] propNames, Object[] objValues,int status,String username);
|
|
|
|
|
int updateValidStatusById(ID id,int status,String username);
|
|
|
|
|
int updateValidStatusByIds(Long[] ids,int status,String username) ;
|
|
|
|
|
int updateValidStatusByProperty(String propName, Object propValue,int status,String username);
|
|
|
|
|
int updateValidStatusByPropertyIn(String propName, Object[] propValues,int status,String username);
|
|
|
|
|
int updateValidStatusByProperties(String[] propNames, Object[] objValues,int status,String username);
|
|
|
|
|
|
|
|
|
|
boolean isExitByProperty(String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public boolean isExitByProperty(String propertyName, Object value);
|
|
|
|
|
boolean isExitByProperty(String[] propertyNames, Object[] values);
|
|
|
|
|
|
|
|
|
|
public boolean isExitByProperty(String[] propertyNames, Object[] values);
|
|
|
|
|
boolean isExitByHqlWhere(String hqlWhere,String[] propertyNames, Object[] values);
|
|
|
|
|
|
|
|
|
|
public boolean isExitByHqlWhere(String hqlWhere,String[] propertyNames, Object[] values);
|
|
|
|
|
boolean isExitByHqlWhere(String hqlWhere);
|
|
|
|
|
|
|
|
|
|
public boolean isExitByHqlWhere(String hqlWhere);
|
|
|
|
|
@Deprecated
|
|
|
|
|
boolean isExitByHql(String hql);
|
|
|
|
|
|
|
|
|
|
public boolean isExitByHql(String hql);
|
|
|
|
|
boolean isExitByHql(DdlPackBean packBean);
|
|
|
|
|
|
|
|
|
|
public boolean isExitByHql(String hql,String[] paramName,Object[] paramValue);
|
|
|
|
|
boolean isExitByHql(String hql,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public boolean isExitBySql(String sql);
|
|
|
|
|
boolean isExitBySql(String sql);
|
|
|
|
|
|
|
|
|
|
public double findSumByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
double findSumByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public double findSumByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
double findSumByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public double findAvgByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
double findAvgByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public double findAvgByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
double findAvgByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public double findMaxByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
double findMaxByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public double findMaxByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
double findMaxByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
|
|
|
|
|
public double findMinByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
double findMinByProperty(String sumPropertyName,String groupByName,String propertyName, Object value);
|
|
|
|
|
|
|
|
|
|
public double findMinByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
double findMinByProperties(String sumPropertyName,String groupByName,String[] paramName,Object[] paramValue);
|
|
|
|
|
}
|
|
|
|
|