FINERACT-412 - Add Share account in Global Search

This commit is contained in:
Ippez Robert
2017-03-03 13:13:31 +03:00
parent c1af6d6685
commit 9b8d253217
3 changed files with 19 additions and 2 deletions
@@ -85,7 +85,7 @@ public class SearchConstants {
}
public static enum SEARCH_SUPPORTED_RESOURCES {
CLIENTS("clients"), GROUPS("groups"), LOANS("loans"), SAVINGS("savings"), CLIENTIDENTIFIERS("clientIdentifiers");
CLIENTS("clients"), GROUPS("groups"), LOANS("loans"), SAVINGS("savings"), SHARES("shares"), CLIENTIDENTIFIERS("clientIdentifiers");
private final String value;
@@ -28,6 +28,7 @@ public class SearchConditions {
private final Boolean groupSearch;
private final Boolean loanSeach;
private final Boolean savingSeach;
private final Boolean shareSeach;
private final Boolean clientIdentifierSearch;
private Boolean exactMatch;
@@ -43,18 +44,21 @@ public class SearchConditions {
SEARCH_SUPPORTED_RESOURCES.LOANS.name().toLowerCase())) ? true : false;
this.savingSeach = (null == searchResource || searchResource.toLowerCase().contains(
SEARCH_SUPPORTED_RESOURCES.SAVINGS.name().toLowerCase())) ? true : false;
this.shareSeach = (null == searchResource || searchResource.toLowerCase().contains(
SEARCH_SUPPORTED_RESOURCES.SHARES.name().toLowerCase())) ? true : false;
this.clientIdentifierSearch = (null == searchResource || searchResource.toLowerCase().contains(
SEARCH_SUPPORTED_RESOURCES.CLIENTIDENTIFIERS.name().toLowerCase())) ? true : false;
}
public SearchConditions(final String searchQueryParam, final String searchResource, final Boolean clientSearch,
final Boolean groupSearch, final Boolean loanSeach, final Boolean savingSeach, final Boolean clientIdentifierSearch, Boolean exactMatch) {
final Boolean groupSearch, final Boolean loanSeach, final Boolean savingSeach, final Boolean shareSeach, final Boolean clientIdentifierSearch, Boolean exactMatch) {
this.searchQuery = searchQueryParam;
this.searchResource = searchResource;
this.clientSearch = clientSearch;
this.groupSearch = groupSearch;
this.loanSeach = loanSeach;
this.savingSeach = savingSeach;
this.shareSeach = shareSeach;
this.clientIdentifierSearch = clientIdentifierSearch;
this.exactMatch=exactMatch;
}
@@ -84,6 +88,10 @@ public class SearchConditions {
public Boolean isSavingSeach() {
return this.savingSeach;
}
public Boolean isShareSeach() {
return this.shareSeach;
}
public Boolean isClientIdentifierSearch() {
return this.clientIdentifierSearch;
@@ -101,6 +101,11 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
+ " , IFNULL(c.id,g.id) as parentId, IFNULL(c.display_name,g.display_name) as parentName, null as entityMobileNo, s.status_enum as entityStatusEnum, IF(g.id is null, 'client', 'group') as parentType "
+ " from m_savings_account s left join m_client c on s.client_id = c.id left join m_group g ON s.group_id = g.id left join m_office o on o.id = c.office_id left join m_savings_product sp on sp.id=s.product_id "
+ " where (o.hierarchy IS NULL OR o.hierarchy like :hierarchy) and (s.account_no like :search or s.external_id like :search)) ";
final String shareMatchSql = " (select 'SHARE' as entityType, s.id as entityId, sp.name as entityName, s.external_id as entityExternalId, s.account_no as entityAccountNo "
+ " , c.id as parentId, c.display_name as parentName, null as entityMobileNo, s.status_enum as entityStatusEnum, 'client' as parentType "
+ " from m_share_account s left join m_client c on s.client_id = c.id left join m_office o on o.id = c.office_id left join m_share_product sp on sp.id=s.product_id "
+ " where (o.hierarchy IS NULL OR o.hierarchy like :hierarchy) and (s.account_no like :search or s.external_id like :search)) ";
final 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,null as entityMobileNo, c.status_enum as entityStatusEnum, null as parentType "
@@ -122,6 +127,10 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
if (searchConditions.isSavingSeach()) {
sql.append(savingMatchSql).append(union);
}
if (searchConditions.isShareSeach()) {
sql.append(shareMatchSql).append(union);
}
if (searchConditions.isClientIdentifierSearch()) {
sql.append(clientIdentifierMatchSql).append(union);