Merge remote-tracking branch 'ashok/globalsearch'
This commit is contained in:
+1
-1
@@ -67,7 +67,7 @@ public class SearchConstants {
|
||||
}
|
||||
|
||||
public static enum SEARCH_SUPPORTED_RESOURCES {
|
||||
CLIENT("client"), GROUP("group"), LOAN("loan");
|
||||
CLIENTS("clients"), GROUPS("groups"), LOANS("loans"), CLIENTIDENTIFIERS("clientIdentifiers");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
||||
+12
-4
@@ -10,19 +10,22 @@ public class SearchConditions {
|
||||
private final Boolean clientSearch;
|
||||
private final Boolean groupSearch;
|
||||
private final Boolean loanSeach;
|
||||
private final Boolean clientIdentifierSearch;
|
||||
public SearchConditions(String searchQueryParam, String searchResource) {
|
||||
this.searchQuery = searchQueryParam;
|
||||
this.searchResource = searchResource;
|
||||
this.clientSearch = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.CLIENT.name().toLowerCase()))? true : false;
|
||||
this.groupSearch = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.GROUP.name().toLowerCase()))? true : false;
|
||||
this.loanSeach = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.LOAN.name().toLowerCase()))? true : false;
|
||||
this.clientSearch = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.CLIENTS.name().toLowerCase()))? true : false;
|
||||
this.groupSearch = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.GROUPS.name().toLowerCase()))? true : false;
|
||||
this.loanSeach = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.LOANS.name().toLowerCase()))? true : false;
|
||||
this.clientIdentifierSearch = (null == searchResource || searchResource.toLowerCase().contains(SEARCH_SUPPORTED_RESOURCES.CLIENTIDENTIFIERS.name().toLowerCase()))? true : false;
|
||||
}
|
||||
public SearchConditions(String searchQueryParam, String searchResource, Boolean clientSearch, Boolean groupSearch, Boolean loanSeach) {
|
||||
public SearchConditions(String searchQueryParam, String searchResource, Boolean clientSearch, Boolean groupSearch, Boolean loanSeach, Boolean clientIdentifierSearch) {
|
||||
this.searchQuery = searchQueryParam;
|
||||
this.searchResource = searchResource;
|
||||
this.clientSearch = clientSearch;
|
||||
this.groupSearch = groupSearch;
|
||||
this.loanSeach = loanSeach;
|
||||
this.clientIdentifierSearch = clientIdentifierSearch;
|
||||
}
|
||||
|
||||
public String getSearchQuery() {
|
||||
@@ -45,4 +48,9 @@ public class SearchConditions {
|
||||
return this.loanSeach;
|
||||
}
|
||||
|
||||
public Boolean isClientIdentifierSearch() {
|
||||
return this.clientIdentifierSearch;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+18
@@ -66,6 +66,16 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
|
||||
+ " , c.id as parentId, c.display_name as parentName "
|
||||
+ " from m_loan l join m_client c on l.client_id = c.id join m_office o on o.id = c.office_id where o.hierarchy like :hierarchy and l.account_no like :partialSearch and l.account_no not like :search) ";
|
||||
|
||||
String clientIdentifierExactMatchSql = " (select 'CLIENTIDENTIFIER' as entityType, ci.id as entityId, ci.document_key as entityName, "
|
||||
+ " null as entityExternalId, null as entityAccountNo, c.id as parentId, c.display_name as parentName "
|
||||
+ " from m_client_identifier ci join m_client c on ci.client_id=c.id join m_office o on o.id = c.office_id "
|
||||
+ " where o.hierarchy like :hierarchy and ci.document_key like :search) ";
|
||||
|
||||
String clientIdentifierMatchSql = " (select 'CLIENTIDENTIFIER' as entityType, ci.id as entityId, ci.document_key as entityName, "
|
||||
+ " null as entityExternalId, null as entityAccountNo, c.id as parentId, c.display_name as parentName "
|
||||
+ " from m_client_identifier ci join m_client c on ci.client_id=c.id join m_office o on o.id = c.office_id "
|
||||
+ " where o.hierarchy like :hierarchy and ci.document_key like :partialSearch and ci.document_key not like :search) ";
|
||||
|
||||
String groupExactMatchSql = " (select 'GROUP' as entityType, g.id as entityId, g.name as entityName, g.external_id as entityExternalId, NULL as entityAccountNo "
|
||||
+ " , g.office_id as parentId, o.name as parentName "
|
||||
+ " from m_group g join m_office o on o.id = g.office_id where o.hierarchy like :hierarchy and g.name like :search) ";
|
||||
@@ -85,6 +95,10 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
|
||||
sql.append(loanExactMatchSql).append(union);
|
||||
}
|
||||
|
||||
if(searchConditions.isClientIdentifierSearch()){
|
||||
sql.append(clientIdentifierExactMatchSql).append(union);
|
||||
}
|
||||
|
||||
if (searchConditions.isGroupSearch()) {
|
||||
sql.append(groupExactMatchSql).append(union);
|
||||
}
|
||||
@@ -97,6 +111,10 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
|
||||
if (searchConditions.isLoanSeach()) {
|
||||
sql.append(loanMatchSql).append(union);
|
||||
}
|
||||
|
||||
if(searchConditions.isClientIdentifierSearch()){
|
||||
sql.append(clientIdentifierMatchSql).append(union);
|
||||
}
|
||||
|
||||
if (searchConditions.isGroupSearch()) {
|
||||
sql.append(groupMatchSql).append(union);
|
||||
|
||||
Reference in New Issue
Block a user