Package cn.dinodev.spring.data.dao.impl
Class DinoJdbcRepositoryBase<T,K>
java.lang.Object
org.springframework.data.jdbc.repository.support.SimpleJdbcRepository<T,K>
cn.dinodev.spring.data.dao.impl.DinoJdbcRepositoryBase<T,K>
- All Implemented Interfaces:
JdbcHelperExcutor<T,,K> JdbcSelectExecutor<T,,K> org.springframework.data.repository.CrudRepository<T,,K> org.springframework.data.repository.PagingAndSortingRepository<T,,K> org.springframework.data.repository.query.QueryByExampleExecutor<T>,org.springframework.data.repository.Repository<T,K>
public class DinoJdbcRepositoryBase<T,K>
extends org.springframework.data.jdbc.repository.support.SimpleJdbcRepository<T,K>
implements JdbcSelectExecutor<T,K>
- Author:
- Cody Lu
-
Constructor Summary
ConstructorsConstructorDescriptionDinoJdbcRepositoryBase(org.springframework.data.jdbc.core.JdbcAggregateOperations entityOperations, org.springframework.data.relational.core.mapping.RelationalPersistentEntity<T> entity, org.springframework.data.jdbc.core.convert.JdbcConverter converter) -
Method Summary
Modifier and TypeMethodDescriptionlongdelete(DeleteSqlBuilder deleteSqlBuilder) 删除dialect()数据库的DialectentityClass获取实体元信息keyClass()keyClass<MK,MV> Map<MK, MV> queryForMap(SelectSqlBuilder sql, String keyColumn, Class<MK> keyClass, String valueColumn, Class<MV> valueClass) 将查询结果放到Map中<MK,MV> Map<MK, MV> queryForMap(String sql, String keyColumn, Class<MK> keyClass, Class<MV> valueClass, Object... params) 将查询结果放到Map中<P> List<P>根据指定的Native sql。查询列表保存并返回对象<C> String返回指定Entity的表名,并根据TenantTable#TenantLevel分表策略组合表名longupdate(UpdateSqlBuilder updateSqlBuilder) 修改booleanupdateById(K id, Map<String, Object> columnValue) 更新指定列boolean更新指定列,并判断版本,如果版本不对,则不更新,如果版本正确,则版本自动+1Methods inherited from class org.springframework.data.jdbc.repository.support.SimpleJdbcRepository
count, count, delete, deleteAll, deleteAll, deleteAllById, deleteById, exists, existsById, findAll, findAll, findAll, findAll, findAll, findAll, findAllById, findBy, findById, findOne, save, saveAllMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface cn.dinodev.spring.data.dao.JdbcHelperExcutor
tableName, updateById, updateById, updateByIdWithVersion, updateByIdWithVersionMethods inherited from interface cn.dinodev.spring.data.dao.JdbcSelectExecutor
count, count, findAll, findAllById, findAllById, getOne, getOne, getOne, newDelete, newDelete, newInsert, newSelect, newSelect, newSelect, newSelectWithoutTenant, newSelectWithoutTenant, newUpdate, newUpdate, queryForMap, queryList, queryList, queryList, queryList, queryPage, queryPage, queryPage, queryPage
-
Constructor Details
-
DinoJdbcRepositoryBase
public DinoJdbcRepositoryBase(org.springframework.data.jdbc.core.JdbcAggregateOperations entityOperations, org.springframework.data.relational.core.mapping.RelationalPersistentEntity<T> entity, org.springframework.data.jdbc.core.convert.JdbcConverter converter)
-
-
Method Details
-
entityClass
Description copied from interface:JdbcHelperExcutorentityClass- Specified by:
entityClassin interfaceJdbcHelperExcutor<T,K> - Returns:
-
entityMeta
Description copied from interface:JdbcHelperExcutor获取实体元信息- Specified by:
entityMetain interfaceJdbcHelperExcutor<T,K> - Returns:
- entity 元信息
-
keyClass
Description copied from interface:JdbcHelperExcutorkeyClass- Specified by:
keyClassin interfaceJdbcHelperExcutor<T,K> - Returns:
-
dialect
Description copied from interface:JdbcSelectExecutor数据库的Dialect- Specified by:
dialectin interfaceJdbcSelectExecutor<T,K> - Returns:
-
tableName
Description copied from interface:JdbcHelperExcutor返回指定Entity的表名,并根据TenantTable#TenantLevel分表策略组合表名- Specified by:
tableNamein interfaceJdbcHelperExcutor<T,K> - Parameters:
cls- entity class- Returns:
-
queryList
public <P> List<P> queryList(@Nonnull String sql, @Nonnull Class<P> clazz, @Nullable Object... params) Description copied from interface:JdbcSelectExecutor根据指定的Native sql。查询列表- Specified by:
queryListin interfaceJdbcSelectExecutor<T,K> - Type Parameters:
P- Projection类型- Parameters:
sql- Native sql 语句clazz- 要映射的类params- 查询参数- Returns:
- 如果结果为空,则返回 emptyList
-
queryForMap
public <MK,MV> Map<MK,MV> queryForMap(SelectSqlBuilder sql, String keyColumn, Class<MK> keyClass, String valueColumn, Class<MV> valueClass) Description copied from interface:JdbcSelectExecutor将查询结果放到Map中- Specified by:
queryForMapin interfaceJdbcSelectExecutor<T,K> - Type Parameters:
MK- key的类型MV- value的类型keyColumn- 作key的列名keyClass- key的ClassvalueColumn- 作value的列名valueClass- value的Class- Returns:
-
queryForMap
public <MK,MV> Map<MK,MV> queryForMap(String sql, String keyColumn, Class<MK> keyClass, Class<MV> valueClass, Object... params) Description copied from interface:JdbcSelectExecutor将查询结果放到Map中- Specified by:
queryForMapin interfaceJdbcSelectExecutor<T,K> - Type Parameters:
MK- key的类型MV- value的类型keyColumn- 作key的列名keyClass- key的ClassvalueClass- value的Classparams- 查询参数- Returns:
-
save
Description copied from interface:JdbcSelectExecutor保存并返回对象- Specified by:
savein interfaceJdbcSelectExecutor<T,K> - Parameters:
sql- native sqlparams- sql参数- Returns:
-
updateById
Description copied from interface:JdbcHelperExcutor更新指定列- Specified by:
updateByIdin interfaceJdbcHelperExcutor<T,K> - Returns:
-
updateByIdWithVersion
Description copied from interface:JdbcHelperExcutor更新指定列,并判断版本,如果版本不对,则不更新,如果版本正确,则版本自动+1- Specified by:
updateByIdWithVersionin interfaceJdbcHelperExcutor<T,K> - Returns:
-
update
Description copied from interface:JdbcHelperExcutor修改- Specified by:
updatein interfaceJdbcHelperExcutor<T,K> - Returns:
-
delete
Description copied from interface:JdbcHelperExcutor删除- Specified by:
deletein interfaceJdbcHelperExcutor<T,K> - Returns:
-