Skip to content

Commit

Permalink
AMM-514 : 1097- Moving back to previous page take more time (#61)
Browse files Browse the repository at this point in the history
* Optimise DB calls

* Null Condition checked
  • Loading branch information
ravishanigarapu authored Jul 29, 2024
1 parent fe8c560 commit 37c25c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,6 @@ public List<Object[]> getBenMappingByVanSerialNo(@Param("benMapIds") BigInteger
+ "or m.mBeneficiarydetail.lastModDate > :lastModDate ) order by m.benMapId Desc")
Long getBeneficiaryCountsByVillageIDAndLastModifyDate(@Param("villageIDs") List<Integer> villageID, @Param("lastModDate") Timestamp lastModifiedDate);

@Query("SELECT t FROM MBeneficiarymapping t WHERE t.vanSerialNo =:vanSerialNo AND t.vanID=:vanID")
MBeneficiarymapping getMapping(@Param("vanSerialNo") BigInteger vanSerialNo,@Param("vanID") Integer vanID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,12 @@ public List<BeneficiariesDTO> searhBeneficiaryByGovIdentity(String identity)

private MBeneficiarymapping getBeneficiariesDTONew(Object[] benMapArr) {
MBeneficiarymapping benMapOBJ = new MBeneficiarymapping();

benMapOBJ.setBenMapId(getBigIntegerValueFromObject(benMapArr[0]));
benMapOBJ.setCreatedBy(String.valueOf(benMapArr[10]));
benMapOBJ.setCreatedDate((Timestamp) benMapArr[11]);


if (benMapArr != null && benMapArr.length == 12 && benMapArr[8] != null && benMapArr[9] != null) {
benMapOBJ.setBenMapId(getBigIntegerValueFromObject(benMapArr[0]));
benMapOBJ.setCreatedBy(String.valueOf(benMapArr[10]));
benMapOBJ.setCreatedDate((Timestamp) benMapArr[11]);
benMapOBJ = mappingRepo.getMapping(getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]);

RMNCHBeneficiaryDetailsRmnch obj = rMNCHBeneficiaryDetailsRmnchRepo
.getByRegID(((BigInteger) benMapArr[5]).longValue());
Expand All @@ -592,26 +592,6 @@ private MBeneficiarymapping getBeneficiariesDTONew(Object[] benMapArr) {
benMapOBJ.setRchID(obj.getRchid());
}

benMapOBJ.setMBeneficiaryaddress(addressRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[1]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryconsent(consentRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[2]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiarycontact(contactRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[3]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiarydetail(detailRepo
.getWith_vanSerialNo_vanID(getBigIntegerValueFromObject(benMapArr[4]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryregidmapping(regIdRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[5]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryImage(
imageRepo.getWithVanSerialNoVanID((Long) benMapArr[6], (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryAccount(accountRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[7]), (Integer) benMapArr[8]));

benMapOBJ.setMBeneficiaryfamilymappings(familyMapRepo.findByBenMapIdAndVanIDOrderByBenFamilyMapIdAsc(
getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryidentities(identityRepo
.findByBenMapIdAndVanID(getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]));

}
return benMapOBJ;
}
Expand Down

0 comments on commit 37c25c4

Please sign in to comment.