magyari-adam commented on code in PR #4432:
URL: https://github.com/apache/fineract/pull/4432#discussion_r1991236430
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java:
##########
@@ -596,6 +599,27 @@ public LoanTransactionData retrieveLoanTransaction(final
Long loanId, final Long
}
}
+ @Override
+ public org.springframework.data.domain.Page<LoanTransactionData>
retrieveLoanTransactions(
+ @jakarta.validation.constraints.NotNull Long loanId,
Set<LoanTransactionType> excludedTransactionTypes, Pageable pageable) {
+ final org.springframework.data.domain.Page<LoanTransaction>
transactionPage = loanTransactionRepository
+ .findAll((root, query, builder) -> {
+ List<Predicate> predicates = new ArrayList<>();
+
+ final Join<Object, Object> loanjoin = root.join("loan");
+ predicates.add(builder.equal(loanjoin.get("id"), loanId));
+
+ if (excludedTransactionTypes != null &&
!excludedTransactionTypes.isEmpty()) {
+ final List<Integer> excludedTransactionTypeValues =
excludedTransactionTypes.stream()
+ .map(LoanTransactionType::getValue).toList();
+
predicates.add(builder.not(root.get("typeOf").in(excludedTransactionTypeValues)));
+ }
+ return builder.and(predicates.toArray(new Predicate[] {}));
+ }, pageable);
+
+ return transactionPage.map(x ->
x.toData(x.getLoan().getCurrency().toData(), null));
Review Comment:
Made a mapper for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]