adamsaghy commented on code in PR #2777:
URL: https://github.com/apache/fineract/pull/2777#discussion_r1061508505
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepository.java:
##########
@@ -72,14 +73,20 @@ public interface LoanRepository extends JpaRepository<Loan,
Long>, JpaSpecificat
String FIND_ALL_NON_CLOSED = "select loan.id from Loan loan where
loan.loanStatus in (100,200,300,303,304)";
- String FIND_ALL_NON_CLOSED_ONE_DAY_BEHIND = "select loan.id from Loan loan
where loan.loanStatus in (100,200,300,303,304) and (:last_closed_business_date
= loan.lastClosedBusinessDate or loan.lastClosedBusinessDate is NULL)";
+ String FIND_ALL_NON_CLOSED_ONE_DAY_BEHIND = "select loan.id from Loan loan
where loan.loanStatus in (100,200,300,303,304) and (:businessDate =
loan.lastClosedBusinessDate or loan.lastClosedBusinessDate is NULL)";
String FIND_NON_CLOSED_LOAN_THAT_BELONGS_TO_CLIENT = "select loan from
Loan loan where loan.id = :loanId and loan.loanStatus = 300 and loan.client.id
= :clientId";
String FIND_BY_ACCOUNT_NUMBER = "select loan from Loan loan where
loan.accountNumber = :accountNumber";
String FIND_ID_BY_EXTERNAL_ID = "SELECT loan.id FROM Loan loan WHERE
loan.externalId = :externalId";
+ String FIND_OLDEST_COB_PROCESSED_LOAN = "select loan from Loan loan where
loan.lastClosedBusinessDate = (select min(l.lastClosedBusinessDate) from Loan
l)";
+
+ String FIND_OLDEST_COB_PROCESSED_LOAN_DATE_BY_LOAN_IDS = "select
min(loan.lastClosedBusinessDate) from Loan loan where loan.id in :loanIds";
+
+ String FIND_ALL_NON_CLOSED_LOAN_IDS_BEHIND_BY_LOAN_IDS = "select loan.id
from Loan loan where loan.id IN :loanIds and (loan.lastClosedBusinessDate <>
:cobBusinessDate or loan.lastClosedBusinessDate is null)";
Review Comment:
Should we consider to merge 2-3 queries into one and in 1 run get all the
informations in a sorted way?
--
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]