Merge pull request #286 from Kitzanos/fix-assigned-application-pagination-issue-prod
Cherry-pick (Fixed issue for assigned application pagination)
This commit is contained in:
@@ -315,7 +315,8 @@ public class AssignedApplicationsDao {
|
||||
if (pageNo == null || pageNo <= 0) {
|
||||
pageNo = GepafinConstant.DEFAULT_PAGE;
|
||||
}
|
||||
Specification<AssignedApplicationsView> spec = searchByPagination( assignedApplicationPageableRequestBean, user,userId);
|
||||
Long hubId=user.getHub().getId();
|
||||
Specification<AssignedApplicationsView> spec = searchByPagination( assignedApplicationPageableRequestBean,hubId,userId);
|
||||
Page<AssignedApplicationsView> entityPage = assignedApplicationsViewRepository.findAll(spec, PageRequest.of(pageNo - 1, pageLimit));
|
||||
// Prepare the response
|
||||
|
||||
@@ -333,10 +334,10 @@ public class AssignedApplicationsDao {
|
||||
return pageableResponseBean;
|
||||
}
|
||||
|
||||
public Specification<AssignedApplicationsView> searchByPagination(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean, UserEntity userEntity,Long userId) {
|
||||
public Specification<AssignedApplicationsView> searchByPagination(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean, Long hubId,Long userId) {
|
||||
return (root, query, criteriaBuilder) -> {
|
||||
|
||||
List<Predicate> predicates = getPredicates(assignedApplicationPageableRequestBean, criteriaBuilder, root, userEntity,userId);
|
||||
List<Predicate> predicates = getPredicates(assignedApplicationPageableRequestBean, criteriaBuilder, root, hubId,userId);
|
||||
SortBy sortBy = new SortBy(GepafinConstant.CREATED_DATE, true);
|
||||
|
||||
if (assignedApplicationPageableRequestBean.getGlobalFilters() != null
|
||||
@@ -377,7 +378,7 @@ public class AssignedApplicationsDao {
|
||||
|
||||
|
||||
private List<Predicate> getPredicates(AssignedApplicationPageableRequestBean assignedApplicationPageableRequestBean,
|
||||
CriteriaBuilder criteriaBuilder, Root<AssignedApplicationsView> root, UserEntity userEntity,Long userId) {
|
||||
CriteriaBuilder criteriaBuilder, Root<AssignedApplicationsView> root,Long hubId,Long userId) {
|
||||
|
||||
Integer year = null;
|
||||
String search = null;
|
||||
@@ -448,6 +449,8 @@ public class AssignedApplicationsDao {
|
||||
}
|
||||
predicates.add(criteriaBuilder.isFalse(root.get(GepafinConstant.IS_DELETED)));
|
||||
|
||||
predicates.add(criteriaBuilder.equal(root.get(GepafinConstant.HUB_ID), hubId));
|
||||
|
||||
Utils.applyFiltersByPagination(root, criteriaBuilder, predicates, filters);
|
||||
|
||||
return predicates;
|
||||
|
||||
@@ -58,4 +58,7 @@ public class AssignedApplicationsView{
|
||||
|
||||
@Column(name = "IS_DELETED")
|
||||
private Boolean isDeleted;
|
||||
|
||||
@Column(name = "HUB_ID")
|
||||
private Long hubId;
|
||||
}
|
||||
|
||||
@@ -2746,4 +2746,9 @@
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/update_system_email_template_28_04_2025.sql"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="14-05-2025_NK_163815" author="Nisha Kashyap">
|
||||
<sqlFile dbms="postgresql"
|
||||
path="db/dump/update_assigned_application_view_14_5_2025.sql"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
DROP VIEW IF EXISTS gepafin_schema.assigned_applications_view ;
|
||||
|
||||
CREATE OR REPLACE VIEW gepafin_schema.assigned_applications_view AS
|
||||
SELECT
|
||||
-- From assigned_applications
|
||||
aa.id AS id,
|
||||
aa.user_id AS user_id,
|
||||
aa.status AS status,
|
||||
aa.created_date AS created_date,
|
||||
aa.updated_date AS updated_date,
|
||||
aa.is_deleted AS is_deleted,
|
||||
|
||||
-- From application
|
||||
a.id AS application_id,
|
||||
a.hub_id as hub_id,
|
||||
a.status AS application_status,
|
||||
a.submission_date AS submission_date,
|
||||
ae.end_date AS evaluation_end_date,
|
||||
a.ndg AS ndg,
|
||||
a.appointment_id AS appointment_id,
|
||||
|
||||
-- From protocol (OneToOne)
|
||||
p.protocol_number AS protocol_number,
|
||||
|
||||
-- From call (ManyToOne)
|
||||
cl.name AS call_name,
|
||||
|
||||
-- From company (ManyToOne)
|
||||
c.company_name AS company_name,
|
||||
ae.email_send_response AS email_send_response
|
||||
|
||||
FROM gepafin_schema.assigned_applications aa
|
||||
|
||||
-- Join application (ManyToOne from assigned_applications)
|
||||
LEFT JOIN gepafin_schema.application a
|
||||
ON aa.application_id = a.id
|
||||
AND (a.is_deleted IS FALSE OR a.is_deleted IS NULL)
|
||||
|
||||
-- Join application_evaluation (application_id matches + not deleted)
|
||||
LEFT JOIN gepafin_schema.application_evaluation ae
|
||||
ON ae.application_id = a.id
|
||||
AND (ae.is_deleted IS FALSE OR ae.is_deleted IS NULL)
|
||||
|
||||
-- Join protocol (OneToOne from application)
|
||||
LEFT JOIN gepafin_schema.protocol p
|
||||
ON a.protocol_number = p.id
|
||||
|
||||
-- Join call (ManyToOne from application)
|
||||
LEFT JOIN gepafin_schema.call cl
|
||||
ON a.call_id = cl.id
|
||||
|
||||
-- Join company (ManyToOne from application)
|
||||
LEFT JOIN gepafin_schema.company c
|
||||
ON a.company_id = c.id
|
||||
|
||||
WHERE aa.is_deleted IS FALSE OR aa.is_deleted IS NULL;
|
||||
Reference in New Issue
Block a user