Added NDG field in the application pagination API

This commit is contained in:
rajesh
2026-03-24 12:51:31 +05:30
parent 0c23722c75
commit 22eb51a041
6 changed files with 103 additions and 2 deletions

View File

@@ -507,6 +507,7 @@ public class ApplicationDao {
responseBean.setAmountRequested(applicationEntity.getAmountRequested());
responseBean.setDateAccepted(applicationEntity.getDateAccepted());
responseBean.setDateRejected(applicationEntity.getDateRejected());
responseBean.setNdg(applicationEntity.getNdg());
return responseBean;
}
@@ -2004,8 +2005,13 @@ public class ApplicationDao {
searchPattern
);
Predicate ndgPredicate = criteriaBuilder.like(
criteriaBuilder.upper(root.get(GepafinConstant.NDG_STRING)),
searchPattern
);
// Combine them using a single `or()`
Predicate finalPredicate = criteriaBuilder.or(titlePredicate, callTitlePredicate,callNamePredicate,companyName);
Predicate finalPredicate = criteriaBuilder.or(titlePredicate, callTitlePredicate,callNamePredicate,companyName, ndgPredicate);
predicates.add(finalPredicate);
}
@@ -2071,6 +2077,7 @@ public class ApplicationDao {
responseBean.setAmountRequested(applicationView.getAmountRequested());
responseBean.setDateAccepted(applicationView.getDateAccepted());
responseBean.setDateRejected(applicationView.getDateRejected());
responseBean.setNdg(applicationView.getNdg());
return responseBean;
}

View File

@@ -91,5 +91,7 @@ public class ApplicationView implements Serializable {
@Column(name = "CREATED_DATE")
private LocalDateTime createdDate;
@Column(name = "NDG")
private String ndg;
}

View File

@@ -52,4 +52,6 @@ public class ApplicationResponse{
private EvaluationVersionEnum evaluationVersion;
private String ndg;
}

View File

@@ -234,7 +234,7 @@ public interface ApplicationApi {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE)}))
})
@GetMapping(value = "/call/{callId}/csv")
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')|| hasRole('ROLE_INSTRUCTOR_MANAGER')")
public ResponseEntity<byte[]> exportCsv(
HttpServletRequest request, @Parameter(description = "The call id", required = true) @PathVariable(value = "callId", required = true) Long callId);

View File

@@ -3209,4 +3209,8 @@
<changeSet id="16-03-2026_RK_153512" author="Rajesh Khore">
<sqlFile dbms="postgresql" path="db/dump/update_system_email_template_special_amendment_16_03_2026.sql"/>
</changeSet>
<changeSet id="23-03-2026_NK_174724" author="Rajesh Khore">
<sqlFile dbms="postgresql" path="db/dump/update_application_view_23_03_2026.sql"/>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,86 @@
DROP VIEW IF EXISTS gepafin_schema.application_view ;
CREATE OR REPLACE VIEW application_view AS
SELECT
a.id,
a.status,
a.submission_date,
a.comments,
a.amount_requested,
a.amount_accepted,
a.date_accepted,
a.date_rejected,
a.is_deleted,
a.hub_id,
a.user_id,
a.ndg,
a.evaluation_version AS evaluation_version,
a.updated_date AS modified_date,
a.created_date AS created_date,
-- Call Details
a.call_id AS call_id,
cl.name AS call_title,
cl.end_date AS call_end_date,
cl.end_time AS call_end_time,
-- Company Details
a.COMPANY_ID AS company_id,
c.company_name AS company_name,
-- Protocol Details
p.protocol_number AS protocol_number,
-- Assigned User Details from ASSIGNED_APPLICATION and GEPAFIN_USER
COALESCE(aa.user_id, NULL) AS assigned_user_id,
COALESCE(
NULLIF(
TRIM(CONCAT(
COALESCE(u.first_name, ''), ' ',
COALESCE(u.last_name, '')
)),
''
),
''
) AS assigned_user_name,
-- User with Company Details (From Application's User)
COALESCE(uwc.id, NULL) AS user_with_company_id
FROM gepafin_schema.APPLICATION a
-- Join Call Entity
LEFT JOIN gepafin_schema.CALL cl
ON a.CALL_ID = cl.id
-- Join Company Entity (Ensuring it is not deleted)
LEFT JOIN gepafin_schema.COMPANY c
ON a.COMPANY_ID = c.id
-- Join Protocol Entity
LEFT JOIN gepafin_schema.PROTOCOL p
ON a.PROTOCOL_NUMBER = p.id
-- Join Assigned Application Entity (Ensuring it is not deleted)
LEFT JOIN gepafin_schema.assigned_applications aa
ON a.id = aa.APPLICATION_ID
AND (aa.IS_DELETED IS FALSE OR aa.IS_DELETED IS NULL)
-- Join User Entity (Get First & Last Name Combined)
LEFT JOIN gepafin_schema.GEPAFIN_USER u
ON aa.user_id = u.id
-- Get User With Company ID (From Application's User & Company)
LEFT JOIN gepafin_schema.USER_WITH_COMPANY uwc
ON a.user_id = uwc.user_id
AND a.COMPANY_ID = uwc.company_id
AND uwc.is_deleted = FALSE -- Ensuring the user is active
WHERE a.IS_DELETED IS FALSE OR a.IS_DELETED IS NULL;