Package cn.dinodev.spring.data.dao
Interface CrudRepositoryBase<T,K extends Serializable>
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,,K> JdbcHelperExcutor<T,,K> JdbcSelectExecutor<T,,K> org.springframework.data.repository.ListCrudRepository<T,,K> org.springframework.data.repository.PagingAndSortingRepository<T,,K> org.springframework.data.repository.Repository<T,K>
@NoRepositoryBean
public interface CrudRepositoryBase<T,K extends Serializable>
extends org.springframework.data.repository.ListCrudRepository<T,K>, JdbcSelectExecutor<T,K>, org.springframework.data.repository.PagingAndSortingRepository<T,K>
- Author:
- Cody Lu
-
Method Summary
Modifier and TypeMethodDescriptionintcountOk()查询状态为‘ok’的记录数量default T根据id,查询元素对查询结果进行处理,自动注入TenantIddefault T对查询结果进行处理,自动注入TenantIdintupdateStatusById(K id, String status) 状态设置intupdateStatusByIds(Collection<K> ids, String status) 状态设置Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface cn.dinodev.spring.data.dao.JdbcHelperExcutor
delete, entityClass, entityMeta, keyClass, tableName, tableName, update, updateById, updateById, updateById, updateByIdWithVersion, updateByIdWithVersion, updateByIdWithVersionMethods inherited from interface cn.dinodev.spring.data.dao.JdbcSelectExecutor
count, count, dialect, findAll, findAllById, findAllById, getOne, getOne, getOne, newDelete, newDelete, newInsert, newSelect, newSelect, newSelect, newSelectWithoutTenant, newSelectWithoutTenant, newUpdate, newUpdate, queryForMap, queryForMap, queryForMap, queryList, queryList, queryList, queryList, queryList, queryPage, queryPage, queryPage, queryPage, saveMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll, findAll
-
Method Details
-
getById
根据id,查询元素- Parameters:
id-- Returns:
- entity or null
-
postQuery
对查询结果进行处理,自动注入TenantId- Parameters:
entity-- Returns:
-
postQuery
对查询结果进行处理,自动注入TenantId- Parameters:
entities-- Returns:
-
updateStatusByIds
@Modifying @Transactional(rollbackFor=java.lang.Exception.class) @Query("UPDATE #{#entityName} e SET e.status=:status WHERE e.id in :ids") int updateStatusByIds(@Param("ids") Collection<K> ids, @Param("status") String status) 状态设置- Parameters:
ids- 主键id集合status- 状态- Returns:
- 更新记录数
-
updateStatusById
@Modifying @Transactional(rollbackFor=java.lang.Exception.class) @Query("UPDATE #{#entityName} e SET e.status=:status WHERE e.id = :id") int updateStatusById(@Param("id") K id, @Param("status") String status) 状态设置- Parameters:
id- 主键idstatus- 状态- Returns:
- 更新记录数
-
countOk
@Query("SELECT count(1) AS cnt FROM #{#entityName} e WHERE e.status=\'ok\'") int countOk()查询状态为‘ok’的记录数量- Returns:
-