Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #842 from egovernments/ISTE-226
Browse files Browse the repository at this point in the history
Iste 226
  • Loading branch information
pradeepkumarcm-egov authored Jul 3, 2024
2 parents bc2c270 + 1864170 commit b3a6d15
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;

Expand Down Expand Up @@ -281,25 +282,40 @@ public StringBuilder applyFilters(StringBuilder query, List<Object> preparedStat
preparedStatement.add(criteria.getOldConnectionNumber());
}

if (!StringUtils.isEmpty(criteria.getConnectionNumber()) || !StringUtils.isEmpty(criteria.getTextSearch())) {
addClauseIfRequired(preparedStatement, query);

if(!StringUtils.isEmpty(criteria.getConnectionNumber())) {
query.append(" conn.connectionno ~* ? ");
preparedStatement.add(criteria.getConnectionNumber());
}
else {
query.append(" conn.connectionno ~* ? ");
preparedStatement.add(criteria.getTextSearch());
if(ObjectUtils.isEmpty(criteria.getIsOpenPaymentSearch()) || !criteria.getIsOpenPaymentSearch()) {

if (!StringUtils.isEmpty(criteria.getConnectionNumber()) || !StringUtils.isEmpty(criteria.getTextSearch())) {
addClauseIfRequired(preparedStatement, query);

if (!StringUtils.isEmpty(criteria.getConnectionNumber())) {
query.append(" conn.connectionno ~* ? ");
preparedStatement.add(criteria.getConnectionNumber());
} else {
query.append(" conn.connectionno ~* ? ");
preparedStatement.add(criteria.getTextSearch());
}


if (!CollectionUtils.isEmpty(criteria.getConnectionNoSet())) {
query.append(" or conn.connectionno in (").append(createQuery(criteria.getConnectionNoSet())).append(" )");
addToPreparedStatement(preparedStatement, criteria.getConnectionNoSet());
}
}
} else {

if(!CollectionUtils.isEmpty(criteria.getConnectionNoSet())) {
query.append(" or conn.connectionno in (").append(createQuery(criteria.getConnectionNoSet())).append(" )");
addToPreparedStatement(preparedStatement, criteria.getConnectionNoSet());
if (!StringUtils.isEmpty(criteria.getConnectionNumber())){
addClauseIfRequired(preparedStatement, query);
query.append(" conn.connectionno = ? ");
preparedStatement.add(criteria.getConnectionNumber());
}
}

if (!CollectionUtils.isEmpty(criteria.getConnectionNoSet())) {
addClauseIfRequired(preparedStatement, query);
query.append(" conn.connectionno in (").append(createQuery(criteria.getConnectionNoSet())).append(" )");
addToPreparedStatement(preparedStatement, criteria.getConnectionNoSet());
}

if (!StringUtils.isEmpty(criteria.getStatus())) {
addClauseIfRequired(preparedStatement, query);
query.append(" conn.status = ? ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class SearchCriteria {

private Set<String> userIds;

@JsonProperty("isOpenPaymentSearch")
private Boolean isOpenPaymentSearch;

@JsonProperty("status")
private String status;

Expand Down

0 comments on commit b3a6d15

Please sign in to comment.