Github user ShruthiRajaram commented on a diff in the pull request: https://github.com/apache/fineract/pull/452#discussion_r206880756 --- Diff: fineract-provider/src/main/java/org/apache/fineract/portfolio/accountdetails/service/AccountDetailsReadPlatformServiceJpaRepositoryImpl.java --- @@ -493,6 +513,113 @@ public LoanAccountSummaryData mapRow(final ResultSet rs, @SuppressWarnings("unus return new LoanAccountSummaryData(id, accountNo, externalId, productId, loanProductName, shortLoanProductName, loanStatus, loanType, loanCycle, timeline, inArrears,originalLoan,loanBalance,amountPaid); } + + } + private static final class GuarantorLoanAccountSummaryDataMapper implements + RowMapper<GuarantorAccountSummaryData> { + + public String guarantorLoanAccountSummarySchema() { + + final StringBuilder accountsSummary = new StringBuilder( + "l.id as id, l.account_no as accountNo, l.external_id as externalId,"); + accountsSummary + .append(" l.product_id as productId, lp.name as productName, lp.short_name as shortProductName,") + .append(" l.loan_status_id as statusId, l.loan_type_enum as loanType,") + + .append("l.principal_disbursed_derived as originalLoan,") + .append("l.total_outstanding_derived as loanBalance,") + .append("l.total_repayment_derived as amountPaid,") + + .append(" l.loan_product_counter as loanCycle,") + + .append(" l.submittedon_date as submittedOnDate,") + .append(" sbu.username as submittedByUsername, sbu.firstname as submittedByFirstname, sbu.lastname as submittedByLastname,") + + .append(" l.rejectedon_date as rejectedOnDate,") + .append(" rbu.username as rejectedByUsername, rbu.firstname as rejectedByFirstname, rbu.lastname as rejectedByLastname,") + + .append(" l.withdrawnon_date as withdrawnOnDate,") + .append(" wbu.username as withdrawnByUsername, wbu.firstname as withdrawnByFirstname, wbu.lastname as withdrawnByLastname,") + + .append(" l.approvedon_date as approvedOnDate,") + .append(" abu.username as approvedByUsername, abu.firstname as approvedByFirstname, abu.lastname as approvedByLastname,") --- End diff -- Since usernames retrieved from appuser table is not used, can you remove left joins that are not required
---