Interface BasketInvoiceItemsRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<BasketInvoiceItemEntity,,Long> DomainIdRepository<BasketInvoiceItemEntity,,Long> org.springframework.data.jpa.repository.JpaRepository<BasketInvoiceItemEntity,,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<BasketInvoiceItemEntity>,org.springframework.data.repository.ListCrudRepository<BasketInvoiceItemEntity,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<BasketInvoiceItemEntity,,Long> org.springframework.data.repository.PagingAndSortingRepository<BasketInvoiceItemEntity,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<BasketInvoiceItemEntity>,org.springframework.data.repository.Repository<BasketInvoiceItemEntity,Long>
@Repository
public interface BasketInvoiceItemsRepository
extends DomainIdRepository<BasketInvoiceItemEntity,Long>
Provides domain-scoped persistence and statistical queries for basket invoice items.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T extends Object> -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByInvoiceId(Long invoiceId, Integer domainId) findAllByBrowserIdAndDomainId(Long browserId, Integer domainId) findAllByBrowserIdAndItemsBasketInvoiceNullAndDomainId(Long browserId, Integer domainId) findAllByInvoiceIdAndDomainId(Long invoiceId, Integer domainId) org.springframework.data.domain.Page<BasketInvoiceItemEntity>findAllByInvoiceIdAndDomainId(Long invoiceId, Integer domainId, org.springframework.data.domain.Pageable pageable) findBasketItem(Long itemId, Long browserId, Integer domainId, Integer invoiceId) findBasketItemInvoiceNull(Long itemId, Long browserId, Integer domainId) findBasketItemInvoiceNull(Long itemId, Long browserId, Integer domainId, String itemNote) findByInvoiceIdAndItemIdAndDomainId(Long invoiceId, Long itemId, Integer domainId) findFeesForStatistics(Integer domainId, Date dateFrom, Date dateTo, boolean filterByStatus, List<Integer> statusIds, Integer cancelledStatus, List<Integer> legacyFeeItemIds) Finds modern and legacy fee items for invoices matching a date and status filter.findProductsForStatistics(Integer domainId, Date dateFrom, Date dateTo, boolean filterByStatus, List<Integer> statusIds, Integer cancelledStatus) Aggregates sold product quantities for invoices matching a date and status filter.getBrowserIdByInvoiceId(Long invoiceId, Integer domainId) voidupdateInvoiceId(Long invoiceId, Long browserId, Integer domainId) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface sk.iway.iwcm.system.datatable.spring.DomainIdRepository
findAllByDomainId, findAllByDomainId, findAllByIdInAndDomainId, findFirstByIdAndDomainIdMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, updateMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods 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
-
findAllByInvoiceIdAndDomainId
org.springframework.data.domain.Page<BasketInvoiceItemEntity> findAllByInvoiceIdAndDomainId(Long invoiceId, Integer domainId, org.springframework.data.domain.Pageable pageable) -
findAllByInvoiceIdAndDomainId
-
findAllByBrowserIdAndDomainId
-
findAllByBrowserIdAndItemsBasketInvoiceNullAndDomainId
List<BasketInvoiceItemEntity> findAllByBrowserIdAndItemsBasketInvoiceNullAndDomainId(Long browserId, Integer domainId) -
findBasketItemInvoiceNull
@Query("SELECT biie FROM BasketInvoiceItemEntity biie WHERE biie.itemId = :itemId AND biie.browserId = :browserId AND biie.domainId = :domainId AND biie.itemsBasketInvoice IS NULL") List<BasketInvoiceItemEntity> findBasketItemInvoiceNull(@Param("itemId") Long itemId, @Param("browserId") Long browserId, @Param("domainId") Integer domainId) -
findBasketItem
@Query("SELECT biie FROM BasketInvoiceItemEntity biie WHERE biie.itemId = :itemId AND biie.browserId = :browserId AND biie.domainId = :domainId AND biie.invoiceId = :invoiceId") List<BasketInvoiceItemEntity> findBasketItem(@Param("itemId") Long itemId, @Param("browserId") Long browserId, @Param("domainId") Integer domainId, @Param("invoiceId") Integer invoiceId) -
findBasketItemInvoiceNull
@Query("SELECT biie FROM BasketInvoiceItemEntity biie WHERE biie.itemId = :itemId AND biie.browserId = :browserId AND biie.domainId = :domainId AND biie.itemNote = :itemNote AND biie.itemsBasketInvoice IS NULL") List<BasketInvoiceItemEntity> findBasketItemInvoiceNull(@Param("itemId") Long itemId, @Param("browserId") Long browserId, @Param("domainId") Integer domainId, @Param("itemNote") String itemNote) -
findBasketItem
@Query("SELECT biie FROM BasketInvoiceItemEntity biie WHERE biie.itemId = :itemId AND biie.browserId = :browserId AND biie.domainId = :domainId AND biie.invoiceId = :invoiceId AND biie.itemNote = :itemNote") List<BasketInvoiceItemEntity> findBasketItem(@Param("itemId") Long itemId, @Param("browserId") Long browserId, @Param("domainId") Integer domainId, @Param("invoiceId") Integer invoiceId, @Param("itemNote") String itemNote) -
updateInvoiceId
@Transactional @Modifying @Query("UPDATE BasketInvoiceItemEntity biie SET biie.invoiceId = :invoiceId WHERE biie.browserId = :browserId AND biie.invoiceId IS NULL AND biie.domainId = :domainId") void updateInvoiceId(@Param("invoiceId") Long invoiceId, @Param("browserId") Long browserId, @Param("domainId") Integer domainId) -
getBrowserIdByInvoiceId
-
findByInvoiceIdAndItemIdAndDomainId
Optional<BasketInvoiceItemEntity> findByInvoiceIdAndItemIdAndDomainId(Long invoiceId, Long itemId, Integer domainId) -
deleteByInvoiceId
-
findProductsForStatistics
@Query("SELECT biie.itemId AS itemId,\n MAX(biie.itemTitle) AS itemTitle,\n SUM(biie.itemQty) AS quantity\nFROM BasketInvoiceItemEntity biie\nJOIN biie.itemsBasketInvoice bie\nWHERE biie.domainId = :domainId\n AND bie.domainId = :domainId\n AND bie.createDate >= :dateFrom\n AND bie.createDate <= :dateTo\n AND (:filterByStatus = false OR bie.statusId IN :statusIds)\n AND biie.itemId IS NOT NULL\n AND biie.itemId > 0\n AND (bie.statusId IS NULL OR bie.statusId <> :cancelledStatus)\nGROUP BY biie.itemId\n") List<BasketProductStatsProjection> findProductsForStatistics(@Param("domainId") Integer domainId, @Param("dateFrom") Date dateFrom, @Param("dateTo") Date dateTo, @Param("filterByStatus") boolean filterByStatus, @Param("statusIds") List<Integer> statusIds, @Param("cancelledStatus") Integer cancelledStatus) Aggregates sold product quantities for invoices matching a date and status filter.- Parameters:
domainId- domain whose invoice items are includeddateFrom- inclusive start of the reporting intervaldateTo- inclusive end of the reporting intervalfilterByStatus- whether to restrict invoices tostatusIdsstatusIds- invoice statuses included when filtering is enabledcancelledStatus- status excluded from product statistics- Returns:
- aggregated product statistics grouped by product identifier
-
findFeesForStatistics
@Query("SELECT biie.itemId AS itemId,\n biie.itemNote AS itemNote,\n biie.itemPrice AS itemPrice,\n biie.itemQty AS itemQty,\n biie.itemVat AS itemVat,\n bie.currency AS currency,\n bie.userLng AS userLng\nFROM BasketInvoiceItemEntity biie\nJOIN biie.itemsBasketInvoice bie\nWHERE biie.domainId = :domainId\n AND bie.domainId = :domainId\n AND bie.createDate >= :dateFrom\n AND bie.createDate <= :dateTo\n AND (:filterByStatus = false OR bie.statusId IN :statusIds)\n AND (\n biie.itemId = 0\n OR biie.itemId IN :legacyFeeItemIds\n )\n AND (bie.statusId IS NULL OR bie.statusId <> :cancelledStatus)\n") List<BasketFeeStatsProjection> findFeesForStatistics(@Param("domainId") Integer domainId, @Param("dateFrom") Date dateFrom, @Param("dateTo") Date dateTo, @Param("filterByStatus") boolean filterByStatus, @Param("statusIds") List<Integer> statusIds, @Param("cancelledStatus") Integer cancelledStatus, @Param("legacyFeeItemIds") List<Integer> legacyFeeItemIds) Finds modern and legacy fee items for invoices matching a date and status filter.- Parameters:
domainId- domain whose invoice items are includeddateFrom- inclusive start of the reporting intervaldateTo- inclusive end of the reporting intervalfilterByStatus- whether to restrict invoices tostatusIdsstatusIds- invoice statuses included when filtering is enabledcancelledStatus- status excluded from fee statisticslegacyFeeItemIds- document identifiers representing legacy fee items- Returns:
- fee items used to calculate delivery and payment totals
-