Skip to content

Commit

Permalink
fixed fsm & PT appln search
Browse files Browse the repository at this point in the history
  • Loading branch information
Puli-shilpa committed Sep 13, 2024
1 parent 5d37692 commit 2ee399e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ public String getFSMSearchQuery(FSMSearchCriteria criteria, String dsoId, List<O

List<String> applicationNumber = criteria.getApplicationNos();
if (!CollectionUtils.isEmpty(applicationNumber)) {
for (String applicationNo : applicationNumber)
{
String searchPattern="%" + applicationNo.toLowerCase() + "%";
addClauseIfRequired(preparedStmtList, builder);
builder.append(" LOWER(tl.applicationnumber) like ? ");
preparedStmtList.add(searchPattern);
addClauseIfRequired(preparedStmtList, builder);
StringBuilder likeConditions = new StringBuilder();
for(int i=0; i< applicationNumber.size();i++) {
if(i > 0) {
likeConditions.append(" OR ");
}
likeConditions.append("fsm.applicationNo LIKE ?");
}
builder.append("(").append(likeConditions).append(")");
for(String appNumber : applicationNumber) {
preparedStmtList.add("%" + appNumber + "%");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,21 +308,41 @@ else if (criteria.getIsRequestForCount()) {
preparedStmtList.add(criteria.getDoorNo());
}

Set<String> propertyIds = criteria.getPropertyIds();
if (!CollectionUtils.isEmpty(propertyIds)) {
Set<String> propertyIds = criteria.getPropertyIds();
if (!CollectionUtils.isEmpty(propertyIds)) {

addClauseIfRequired(preparedStmtList,builder);
builder.append("property.propertyid IN (").append(createQuery(propertyIds)).append(")");
addToPreparedStatementWithUpperCase(preparedStmtList, propertyIds);
}

int ind=0;
StringBuilder likeCondition = new StringBuilder();
for(String pId : propertyIds) {
if(ind > 0) {
likeCondition.append(" OR ");
}
likeCondition.append("property.propertyid LIKE ?");
ind++;
}
builder.append("(").append(likeCondition).append(")");
for(String pId : propertyIds) {
preparedStmtList.add("%" + pId + "%");
}
}
Set<String> acknowledgementIds = criteria.getAcknowledgementIds();
if (!CollectionUtils.isEmpty(acknowledgementIds)) {
addClauseIfRequired(preparedStmtList, builder);
String searchPattern= acknowledgementIds.stream().filter(id -> id!= null && !id.isEmpty()).map(id-> "LOWER(property.acknowldgementnumber) LIKE ?").collect(Collectors.joining("OR", " (", ") "));
builder.append(searchPattern);
acknowledgementIds.forEach(id-> preparedStmtList.add("%" +id.toLowerCase() + "%"));
}
int index=0;
StringBuilder likeConditions = new StringBuilder();
for(String ackId : acknowledgementIds) {
if(index > 0) {
likeConditions.append(" OR ");
}
likeConditions.append("property.acknowldgementnumber LIKE ?");
index++;
}
builder.append("(").append(likeConditions).append(")");
for(String ackId : acknowledgementIds) {
preparedStmtList.add("%" + ackId + "%");
}
}

Set<String> uuids = criteria.getUuids();
if (!CollectionUtils.isEmpty(uuids)) {
Expand Down

0 comments on commit 2ee399e

Please sign in to comment.