Skip to content

Commit

Permalink
MOSIP:36804 - Filter related changes in API GET /partners/v3
Browse files Browse the repository at this point in the history
Signed-off-by: sudeep <[email protected]>
  • Loading branch information
Sudeep7353 committed Oct 24, 2024
1 parent 8260962 commit 301d198
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

@Data
public class FilterDto {
private String partnerId = "";
private String partnerTypeCode = "";
private String organizationName = "";
private String policyGroupName = "";
private String certificateUploadStatus = "";
private String emailAddress = "";
private String partnerId;
private String partnerTypeCode;
private String organizationName;
private String policyGroupName;
private String certificateUploadStatus;
private String emailAddress;
private Boolean isActive;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
@Repository("PartnerSummaryRepository")
public interface PartnerSummaryRepository extends BaseRepository<PartnerSummaryEntity, String> {

@Query("SELECT new PartnerSummaryEntity(" +
@Query(value = "SELECT new PartnerSummaryEntity(" +
"p.id, p.partnerTypeCode, p.name, p.policyGroup.id, pg.name, " +
"p.emailId, CASE WHEN p.certificateAlias IS NULL THEN 'not_uploaded' ELSE 'uploaded' END, " +
"p.approvalStatus, p.isActive, p.crDtimes) " +
"FROM PartnerV3 p " +
"LEFT JOIN p.policyGroup pg " +
"WHERE (:partnerId = '' OR p.id LIKE CONCAT('%', :partnerId, '%')) " +
"AND (:partnerTypeCode = '' OR p.partnerTypeCode LIKE CONCAT('%', :partnerTypeCode, '%')) " +
"AND (:organizationName = '' OR p.name LIKE CONCAT('%', :organizationName, '%')) " +
"AND (:policyGroupName = '' OR pg.name LIKE CONCAT('%', :policyGroupName, '%')) " +
"AND (:certificateUploadStatus = '' OR " +
"WHERE (:partnerId IS NULL OR p.id LIKE %:partnerId%) " +
"AND (:partnerTypeCode IS NULL OR p.partnerTypeCode LIKE %:partnerTypeCode%) " +
"AND (:organizationName IS NULL OR p.name LIKE %:organizationName%) " +
"AND (:policyGroupName IS NULL OR pg.name LIKE %:policyGroupName%) " +
"AND (:certificateUploadStatus IS NULL OR " +
"(:certificateUploadStatus = 'not_uploaded' AND p.certificateAlias IS NULL) " +
"OR (:certificateUploadStatus = 'uploaded' AND p.certificateAlias IS NOT NULL)) " +
"AND (:emailAddress = '' OR p.emailId LIKE CONCAT('%', :emailAddress, '%')) " +
"AND (:emailAddress IS NULL OR p.emailId LIKE %:emailAddress%) " +
"AND (:isActive IS NULL OR p.isActive = :isActive)"
)
Page<PartnerSummaryEntity> getSummaryOfAllPartners(
Expand Down

0 comments on commit 301d198

Please sign in to comment.