1
0

hs-office-coopshares: use only membership uuid in filter

This commit is contained in:
Michael Hoennig
2022-10-19 18:15:21 +02:00
parent 5764accbc5
commit ca0589d084
5 changed files with 56 additions and 16 deletions

View File

@ -40,14 +40,13 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar
final String currentUser,
final String assumedRoles,
final UUID membershipUuid,
Integer memberNumber, // TODO: remove
final @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate fromValueDate,
final @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate toValueDate) {
context.define(currentUser, assumedRoles);
final var entities = coopSharesTransactionRepo.findCoopSharesTransactionByOptionalMembershipUuidAndDateRange(
memberNumber,
membershipUuid,
fromValueDate,
toValueDate);

View File

@ -14,13 +14,13 @@ public interface HsOfficeCoopSharesTransactionRepository extends Repository<HsOf
@Query("""
SELECT st FROM HsOfficeCoopSharesTransactionEntity st
WHERE (:memberNumber IS NULL OR st.membership.memberNumber = :memberNumber)
WHERE ( CAST(:membershipUuid AS org.hibernate.type.UUIDCharType) IS NULL OR st.membership.uuid = :membershipUuid)
AND ( CAST(:fromValueDate AS java.time.LocalDate) IS NULL OR (st.valueDate >= :fromValueDate))
AND ( CAST(:toValueDate AS java.time.LocalDate)IS NULL OR (st.valueDate <= :toValueDate))
ORDER BY st.membership.memberNumber, st.valueDate
""")
List<HsOfficeCoopSharesTransactionEntity> findCoopSharesTransactionByOptionalMembershipUuidAndDateRange(
Integer memberNumber, LocalDate fromValueDate, LocalDate toValueDate);
UUID membershipUuid, LocalDate fromValueDate, LocalDate toValueDate);
HsOfficeCoopSharesTransactionEntity save(final HsOfficeCoopSharesTransactionEntity entity);