Interface ProductRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Product,,String> org.springframework.data.jpa.repository.JpaRepository<Product,,String> org.springframework.data.repository.PagingAndSortingRepository<Product,,String> org.springframework.data.repository.query.QueryByExampleExecutor<Product>,org.springframework.data.repository.Repository<Product,String>
@Repository
public interface ProductRepository
extends org.springframework.data.jpa.repository.JpaRepository<Product,String>
Repository for queries for products.
-
Method Summary
Modifier and TypeMethodDescriptionfindByBackofficeIdAndCoreContractIdAndCoreProductDetailAndUserId(Integer backOfficeId, String coreContractId, String coreProductDetail, String userId) Retrieve the product that meets the given criteria in the arguments.findByBackofficeIdAndSubsystemAndCoreProductIdAndUserId(Integer backOfficeId, String subsystem, String coreProductId, String userId) Retrieve the product that meets the given criteria in the arguments.findByCoreProductIdAndContractId(String coreProductId, String coreContractId) Retrieve the product that meets the given criteria in the arguments.Retrieves an entity by its id.findByUserIdAndBackofficeId(String userId, Integer backOfficeId) Get all products of the given user.findByUserIdAndBackofficeIdAndContractId(String userId, Integer backOfficeId, String contractId) Get all products of the given user, backoffice and contract.findByUserIdAndCoreProductDetail(String userId, String coreProductDetail) Retrieve the product that meets the given criteria in the arguments.findOneByCoreProductId(String coreProductId) Retrieve an entity by core product Id.findUserIdByBackofficeIdAndCoreProductId(Integer backOfficeId, String coreProductId) Retrieve the user ids of products that meets the given criteria in the arguments.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, 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
-
findByUserIdAndBackofficeId
@Query(value="SELECT * FROM product WHERE user_id = ?1 and backoffice_id = ?2", nativeQuery=true) List<Product> findByUserIdAndBackofficeId(String userId, Integer backOfficeId) Get all products of the given user.- Parameters:
userId- user identifier.backOfficeId- back office identifier.- Returns:
- the given user products.
-
findByUserIdAndBackofficeIdAndContractId
@Query(value="SELECT * FROM product WHERE user_id = ?1 and backoffice_id = ?2 and (eb_contract_id = ?3 or eb_contract_id is null)", nativeQuery=true) List<Product> findByUserIdAndBackofficeIdAndContractId(String userId, Integer backOfficeId, String contractId) Get all products of the given user, backoffice and contract.- Parameters:
userId- user identifier.backOfficeId- back office identifier.contractId- back office identifier.- Returns:
- the given user products.
-
findById
Retrieves an entity by its id.- Specified by:
findByIdin interfaceorg.springframework.data.repository.CrudRepository<Product,String> - Parameters:
id- must not be null.- Returns:
- the entity with the given id or Optional#empty() if none found
- Throws:
IllegalArgumentException- ifidis null.
-
findByBackofficeIdAndSubsystemAndCoreProductIdAndUserId
@Query(value="SELECT * FROM product WHERE backoffice_id = ?1 AND core_subsystem = ?2 AND core_product_id = ?3 AND user_id = ?4", nativeQuery=true) Optional<Product> findByBackofficeIdAndSubsystemAndCoreProductIdAndUserId(Integer backOfficeId, String subsystem, String coreProductId, String userId) Retrieve the product that meets the given criteria in the arguments.- Parameters:
backOfficeId- back office identifier.subsystem- subsystem.coreProductId- core product identifier.userId- user identifier.- Returns:
- the product that meets the given criteria in the arguments.
-
findOneByCoreProductId
Retrieve an entity by core product Id.- Parameters:
coreProductId- unique core product identifier.- Returns:
- the product that meets the given core product id.
-
findByCoreProductIdAndContractId
@Query(value="SELECT * FROM product WHERE core_product_id = ?1 AND eb_contract_id = ?2", nativeQuery=true) Optional<Product> findByCoreProductIdAndContractId(String coreProductId, String coreContractId) Retrieve the product that meets the given criteria in the arguments.- Parameters:
coreProductId- core product identifier.coreContractId- core contract identifier.- Returns:
- the product that meets the given criteria in the arguments.
-
findByBackofficeIdAndCoreContractIdAndCoreProductDetailAndUserId
@Query(value="SELECT * FROM product WHERE backoffice_id = ?1 AND eb_contract_id = ?2 AND core_product_detail = ?3 AND user_id = ?4", nativeQuery=true) Optional<Product> findByBackofficeIdAndCoreContractIdAndCoreProductDetailAndUserId(Integer backOfficeId, String coreContractId, String coreProductDetail, String userId) Retrieve the product that meets the given criteria in the arguments.- Parameters:
backOfficeId- back office identifier.coreContractId- core contract identifier.coreProductDetail- core product identifier.userId- user identifier.- Returns:
- the product that meets the given criteria in the arguments.
-
findUserIdByBackofficeIdAndCoreProductId
@Query(value="SELECT user_id FROM product WHERE backoffice_id = ?1 AND core_product_id = ?2", nativeQuery=true) List<String> findUserIdByBackofficeIdAndCoreProductId(Integer backOfficeId, String coreProductId) Retrieve the user ids of products that meets the given criteria in the arguments.- Parameters:
backOfficeId- back office identifier.coreProductId- core product identifier.- Returns:
- the user id that meets the given criteria in the arguments.
-
findByUserIdAndCoreProductDetail
@Query(value="SELECT * FROM product WHERE user_id = ?1 AND core_product_detail = ?2", nativeQuery=true) List<Product> findByUserIdAndCoreProductDetail(String userId, String coreProductDetail) Retrieve the product that meets the given criteria in the arguments.- Parameters:
userId- user identifier.coreProductDetail- Pan token product.- Returns:
- the product that meets the given criteria in the arguments.
-