adamsaghy commented on code in PR #2783:
URL: https://github.com/apache/fineract/pull/2783#discussion_r1039287520


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientRepository.java:
##########
@@ -29,4 +29,35 @@ interface ClientRepository extends JpaRepository<Client, 
Long>, JpaSpecification
 
     @Query(FIND_CLIENT_BY_ACCOUNT_NUMBER)
     Client getClientByAccountNumber(@Param("accountNumber") String 
accountNumber);
+
+    @Query("""
+            SELECT client.id
+            FROM Client client
+            WHERE client.externalId = :externalId
+                """)
+    Long getClientIdByExternalId(String externalId);
+
+    @Query("""
+            SELECT client
+            FROM Client client
+            JOIN client.office office
+            LEFT JOIN client.transferToOffice transferToOffice
+            WHERE client.id = :clientId
+            AND (office.hierarchy LIKE :officeHierarchy OR 
transferToOffice.hierarchy LIKE :transferToOfficeHierarchy)
+                """)
+    Client fetchByClientIdAndHierarchy(Long clientId, String officeHierarchy, 
String transferToOfficeHierarchy);
+
+    @Query("""
+            SELECT client
+            FROM Client client
+            JOIN client.office office
+            LEFT JOIN client.transferToOffice transferToOffice
+            WHERE client.externalId = :externalId
+            AND (office.hierarchy LIKE :officeHierarchy OR 
transferToOffice.hierarchy LIKE :transferToOfficeHierarchy)
+                """)
+    Client fetchByExternalIdAndHierarchy(String externalId, String 
officeHierarchy, String transferToOfficeHierarchy);
+
+    @Query("SELECT c.id FROM Client c WHERE c.externalId = :externalId")
+    Long findIdByExternalId(@Param("externalId") String externalId);

Review Comment:
   What is the difference between this method and "getClientIdByExternalId" ?



-- 
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]

Reply via email to