FINERACT-1724: Add missing Params annotations

This commit is contained in:
Adam Saghy
2023-06-12 15:01:10 +02:00
parent db4a4b2b83
commit 7cb4b6957b
6 changed files with 18 additions and 10 deletions
@@ -23,6 +23,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface CommandSourceRepository extends JpaRepository<CommandSource, Long>, JpaSpecificationExecutor<CommandSource> { public interface CommandSourceRepository extends JpaRepository<CommandSource, Long>, JpaSpecificationExecutor<CommandSource> {
@@ -30,6 +31,6 @@ public interface CommandSourceRepository extends JpaRepository<CommandSource, Lo
@Modifying(flushAutomatically = true) @Modifying(flushAutomatically = true)
@Query("delete from CommandSource c where c.status = :status and c.madeOnDate is not null and c.madeOnDate <= :dateForPurgeCriteria") @Query("delete from CommandSource c where c.status = :status and c.madeOnDate is not null and c.madeOnDate <= :dateForPurgeCriteria")
void deleteOlderEventsWithStatus(Integer status, OffsetDateTime dateForPurgeCriteria); void deleteOlderEventsWithStatus(@Param("status") Integer status, @Param("dateForPurgeCriteria") OffsetDateTime dateForPurgeCriteria);
} }
@@ -28,6 +28,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface ExternalEventRepository extends JpaRepository<ExternalEvent, Long> { public interface ExternalEventRepository extends JpaRepository<ExternalEvent, Long> {
@@ -35,9 +36,10 @@ public interface ExternalEventRepository extends JpaRepository<ExternalEvent, Lo
@Modifying(flushAutomatically = true) @Modifying(flushAutomatically = true)
@Query("delete from ExternalEvent e where e.status = :status and e.businessDate <= :dateForPurgeCriteria") @Query("delete from ExternalEvent e where e.status = :status and e.businessDate <= :dateForPurgeCriteria")
void deleteOlderEventsWithSentStatus(ExternalEventStatus status, LocalDate dateForPurgeCriteria); void deleteOlderEventsWithSentStatus(@Param("status") ExternalEventStatus status,
@Param("dateForPurgeCriteria") LocalDate dateForPurgeCriteria);
@Modifying @Modifying
@Query("UPDATE ExternalEvent e SET e.status = org.apache.fineract.infrastructure.event.external.repository.domain.ExternalEventStatus.SENT, e.sentAt = :sentAt WHERE e.id IN :ids") @Query("UPDATE ExternalEvent e SET e.status = org.apache.fineract.infrastructure.event.external.repository.domain.ExternalEventStatus.SENT, e.sentAt = :sentAt WHERE e.id IN :ids")
void markEventsSent(List<Long> ids, OffsetDateTime sentAt); void markEventsSent(@Param("ids") List<Long> ids, @Param("sentAt") OffsetDateTime sentAt);
} }
@@ -22,11 +22,12 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface LoanCollateralManagementRepository public interface LoanCollateralManagementRepository
extends JpaRepository<LoanCollateralManagement, Long>, JpaSpecificationExecutor<LoanCollateralManagement> { extends JpaRepository<LoanCollateralManagement, Long>, JpaSpecificationExecutor<LoanCollateralManagement> {
@Query("select loanCollaterals from LoanCollateralManagement loanCollaterals where loanCollaterals.loan=:loan") @Query("select loanCollaterals from LoanCollateralManagement loanCollaterals where loanCollaterals.loan=:loan")
List<LoanCollateralManagement> findByLoan(Loan loan); List<LoanCollateralManagement> findByLoan(@Param("loan") Loan loan);
} }
@@ -25,6 +25,7 @@ import org.apache.fineract.portfolio.loanaccount.data.LoanScheduleDelinquencyDat
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface LoanRepaymentScheduleInstallmentRepository public interface LoanRepaymentScheduleInstallmentRepository
extends JpaRepository<LoanRepaymentScheduleInstallment, Long>, JpaSpecificationExecutor<LoanRepaymentScheduleInstallment> { extends JpaRepository<LoanRepaymentScheduleInstallment, Long>, JpaSpecificationExecutor<LoanRepaymentScheduleInstallment> {
@@ -42,8 +43,8 @@ public interface LoanRepaymentScheduleInstallmentRepository
lrs.loan.loanProduct.delinquencyBucket IS NOT NULL lrs.loan.loanProduct.delinquencyBucket IS NOT NULL
GROUP BY lrs.loan GROUP BY lrs.loan
""") """)
Collection<LoanScheduleDelinquencyData> fetchLoanScheduleDataByDueDateAndObligationsMet(Integer loanStatus, LocalDate businessDate, Collection<LoanScheduleDelinquencyData> fetchLoanScheduleDataByDueDateAndObligationsMet(@Param("loanStatus") Integer loanStatus,
boolean obligationsMet); @Param("businessDate") LocalDate businessDate, @Param("obligationsMet") boolean obligationsMet);
@Query(""" @Query("""
SELECT new org.apache.fineract.portfolio.loanaccount.data.LoanScheduleDelinquencyData( SELECT new org.apache.fineract.portfolio.loanaccount.data.LoanScheduleDelinquencyData(
@@ -59,7 +60,8 @@ public interface LoanRepaymentScheduleInstallmentRepository
lrs.loan.id NOT IN :loanIds lrs.loan.id NOT IN :loanIds
GROUP BY lrs.loan GROUP BY lrs.loan
""") """)
Collection<LoanScheduleDelinquencyData> fetchLoanScheduleDataByDueDateAndObligationsMet(Integer loanStatus, LocalDate businessDate, Collection<LoanScheduleDelinquencyData> fetchLoanScheduleDataByDueDateAndObligationsMet(@Param("loanStatus") Integer loanStatus,
boolean obligationsMet, List<Long> loanIds); @Param("businessDate") LocalDate businessDate, @Param("obligationsMet") boolean obligationsMet,
@Param("loanIds") List<Long> loanIds);
} }
@@ -22,10 +22,11 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface LoanRescheduleRequestRepository public interface LoanRescheduleRequestRepository
extends JpaRepository<LoanRescheduleRequest, Long>, JpaSpecificationExecutor<LoanRescheduleRequest> { extends JpaRepository<LoanRescheduleRequest, Long>, JpaSpecificationExecutor<LoanRescheduleRequest> {
@Query("select lrr.loan.id from LoanRescheduleRequest lrr where lrr.id = :rescheduleRequestId") @Query("select lrr.loan.id from LoanRescheduleRequest lrr where lrr.id = :rescheduleRequestId")
Optional<Long> getLoanIdByRescheduleRequestId(Long rescheduleRequestId); Optional<Long> getLoanIdByRescheduleRequestId(@Param("rescheduleRequestId") Long rescheduleRequestId);
} }
@@ -20,6 +20,7 @@ package org.apache.fineract.useradministration.domain;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface PermissionRepository extends JpaRepository<Permission, Long> { public interface PermissionRepository extends JpaRepository<Permission, Long> {
@@ -28,5 +29,5 @@ public interface PermissionRepository extends JpaRepository<Permission, Long> {
// Also, trimming leading and trailing spaces is critical ("CREATE_STANDINGINSTRUCTION" vs // Also, trimming leading and trailing spaces is critical ("CREATE_STANDINGINSTRUCTION" vs
// "CREATE_STANDINGINSTRUCTION "). // "CREATE_STANDINGINSTRUCTION ").
@Query("SELECT p FROM Permission p WHERE LOWER(TRIM(BOTH FROM p.code)) = LOWER(TRIM(BOTH FROM ?1))") @Query("SELECT p FROM Permission p WHERE LOWER(TRIM(BOTH FROM p.code)) = LOWER(TRIM(BOTH FROM ?1))")
Permission findOneByCode(String code); Permission findOneByCode(@Param("code") String code);
} }