Updated status filter in get all application api
This commit is contained in:
@@ -294,11 +294,11 @@ public class ApplicationDao {
|
||||
// return applicationResponses;
|
||||
// }
|
||||
|
||||
public List<ApplicationResponse> getAllApplications(UserEntity userEntity, Long callId, Long companyId,String status) {
|
||||
public List<ApplicationResponse> getAllApplications(UserEntity userEntity, Long callId, Long companyId,List<ApplicationStatusTypeEnum> statusList) {
|
||||
|
||||
log.info("Fetching applications for RoleType: {}", userEntity.getRoleEntity().getRoleType());
|
||||
|
||||
Specification<ApplicationEntity> spec = search(userEntity, callId, companyId,status);
|
||||
Specification<ApplicationEntity> spec = search(userEntity, callId, companyId,statusList);
|
||||
|
||||
List<ApplicationEntity> applicationEntities = applicationRepository.findAll(spec);
|
||||
|
||||
@@ -308,7 +308,7 @@ public class ApplicationDao {
|
||||
}
|
||||
|
||||
|
||||
private Specification<ApplicationEntity> search(UserEntity userEntity, Long callId, Long companyId,String status) {
|
||||
private Specification<ApplicationEntity> search(UserEntity userEntity, Long callId, Long companyId,List<ApplicationStatusTypeEnum> statusList) {
|
||||
return (root, query, builder) -> {
|
||||
Boolean isBeneficiary = validator.checkIsBeneficiary();
|
||||
Predicate predicate = builder.isFalse(root.get("isDeleted"));
|
||||
@@ -321,8 +321,11 @@ public class ApplicationDao {
|
||||
if (companyId != null) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("company").get("id"), companyId));
|
||||
}
|
||||
if (status != null) {
|
||||
predicate = builder.and(predicate, builder.equal(root.get("status"), status));
|
||||
if (statusList != null && !statusList.isEmpty()) {
|
||||
List<String> statusNames = statusList.stream()
|
||||
.map(Enum::name)
|
||||
.collect(Collectors.toList());
|
||||
predicate = builder.and(predicate, root.get("status").in(statusNames));
|
||||
}
|
||||
predicate = builder.and(predicate, builder.equal(root.get("hubId"), userEntity.getHub().getId()));
|
||||
return predicate;
|
||||
|
||||
Reference in New Issue
Block a user