You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by aw...@apache.org on 2019/09/02 20:43:52 UTC
[fineract-cn-reporting] 07/47: only add where if criteria available
added trialing 00 if no decimals available
This is an automated email from the ASF dual-hosted git repository.
awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-reporting.git
commit fe4f978fe82830e0d3dd19539a5c75a188647520
Author: mgeiss <mg...@mifos.org>
AuthorDate: Sat Jul 8 05:24:59 2017 +0200
only add where if criteria available
added trialing 00 if no decimals available
---
.../internal/specification/CustomerListReportSpecification.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java b/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
index c799f68..90bfbd9 100644
--- a/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
+++ b/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
@@ -193,7 +193,7 @@ public class CustomerListReportSpecification implements ReportSpecification {
row.getValues().add(value);
}
- final DecimalFormat decimalFormat = new DecimalFormat("0.##");
+ final DecimalFormat decimalFormat = new DecimalFormat("0.00");
final Query accountQuery = this.entityManager.createNativeQuery(this.buildAccountQuery(reportRequest, customerIdentifier));
final List<?> accountResultList = accountQuery.getResultList();
final ArrayList<String> values = new ArrayList<>();
@@ -260,7 +260,6 @@ public class CustomerListReportSpecification implements ReportSpecification {
final List<QueryParameter> queryParameters = reportRequest.getQueryParameters();
if (!queryParameters.isEmpty()) {
- query.append(" WHERE ");
final ArrayList<String> criteria = new ArrayList<>();
queryParameters.forEach(queryParameter -> {
if(queryParameter.getValue() != null && !queryParameter.getValue().isEmpty()) {
@@ -270,7 +269,11 @@ public class CustomerListReportSpecification implements ReportSpecification {
}
});
- query.append(criteria.stream().collect(Collectors.joining(" AND ")));
+ if (!criteria.isEmpty()) {
+ query.append(" WHERE ");
+ query.append(criteria.stream().collect(Collectors.joining(" AND ")));
+ }
+
}
query.append(" ORDER BY cst.identifier");