Interface UserCompanyRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserCompany,,Integer> org.springframework.data.jpa.repository.JpaRepository<UserCompany,,Integer> org.springframework.data.repository.PagingAndSortingRepository<UserCompany,,Integer> org.springframework.data.repository.query.QueryByExampleExecutor<UserCompany>,org.springframework.data.repository.Repository<UserCompany,Integer>
@Repository
public interface UserCompanyRepository
extends org.springframework.data.jpa.repository.JpaRepository<UserCompany,Integer>
Repository for queries for User Company.
-
Method Summary
Modifier and TypeMethodDescriptionfindAllByCompanyId(Integer companyId) Find all UserCompany objects for company id.findEnabledByUser(String userId) Find active User Company for user.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findEnabledByUser
@Query("SELECT uc FROM UserCompany uc WHERE uc.user.id = :userId AND uc.enabled = true AND uc.company.active = true") Optional<UserCompany> findEnabledByUser(@Param("userId") String userId) Find active User Company for user.- Parameters:
userId- user identifier.- Returns:
- User Company enabled.
-
findAllByCompanyId
@Query("SELECT uc FROM UserCompany uc WHERE uc.company.id = :companyId AND uc.enabled = true") List<UserCompany> findAllByCompanyId(@Param("companyId") Integer companyId) Find all UserCompany objects for company id.- Parameters:
companyId- company identifier.- Returns:
- User Company list.
-