Interface EbContractRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<EbContract,,String> org.springframework.data.jpa.repository.JpaRepository<EbContract,,String> org.springframework.data.repository.PagingAndSortingRepository<EbContract,,String> org.springframework.data.repository.query.QueryByExampleExecutor<EbContract>,org.springframework.data.repository.Repository<EbContract,String>
@Repository
public interface EbContractRepository
extends org.springframework.data.jpa.repository.JpaRepository<EbContract,String>
Repository interface to do queries for Users data.
-
Method Summary
Modifier and TypeMethodDescriptionfindBackofficeIdByUserId(String userId) Get all products of the given user.findByIdAndUserId(String contractId, String userId) Get all products of the given contract and user.findContractWithCoreContractIdAndCoreEbUserIdAndBackofficeId(String coreContractId, String coreEbUserId, Integer backOfficeId) Get all products of the given user.<S extends EbContract>
SsaveAndFlush(S entity) Saves an entity and flushes changes instantly.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, saveAllAndFlushMethods 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
-
saveAndFlush
Saves an entity and flushes changes instantly.- Specified by:
saveAndFlushin interfaceorg.springframework.data.jpa.repository.JpaRepository<EbContract,String> - Parameters:
entity- user entity to save.- Returns:
- the saved entity
-
findBackofficeIdByUserId
@Query(value="SELECT DISTINCT backoffice_id, core_eb_user_id as core_user_id FROM eb_contract WHERE user_id = ?1", nativeQuery=true) List<Map<String,Object>> findBackofficeIdByUserId(String userId) Get all products of the given user.- Parameters:
userId- user identifier.- Returns:
- the given user contracts.
-
findByIdAndUserId
@Query("SELECT ec FROM EbContract ec WHERE ec.id = ?1 and ec.user.id = ?2") EbContract findByIdAndUserId(String contractId, String userId) Get all products of the given contract and user.- Parameters:
contractId- contract identifier.userId- user identifier.- Returns:
- the given user contracts.
-
findContractWithCoreContractIdAndCoreEbUserIdAndBackofficeId
@Query("SELECT ec FROM EbContract ec WHERE ec.coreContractId = ?1 and ec.coreEbUserId = ?2 and ec.backOfficeId = ?3") EbContract findContractWithCoreContractIdAndCoreEbUserIdAndBackofficeId(String coreContractId, String coreEbUserId, Integer backOfficeId) Get all products of the given user.- Parameters:
coreContractId- core contract identifier.coreEbUserId- core eb user identifier.backOfficeId- backoffice identifier.- Returns:
- the given user contracts.
-