FINERACT-984-4: More database independence
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
16207ef952
commit
4a5919a4a7
+1
-1
@@ -80,7 +80,7 @@ public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformSe
|
||||
public List<GLClosureData> retrieveAllGLClosures(final Long officeId) {
|
||||
final GLClosureMapper rm = new GLClosureMapper();
|
||||
|
||||
String sql = "select " + rm.schema() + " and glClosure.is_deleted = 0";
|
||||
String sql = "select " + rm.schema() + " and glClosure.is_deleted = false";
|
||||
final Object[] objectArray = new Object[1];
|
||||
int arrayPos = 0;
|
||||
if (officeId != null && officeId != 0) {
|
||||
|
||||
+2
-2
@@ -130,7 +130,7 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
||||
if (associationParametersData != null) {
|
||||
if (associationParametersData.isRunningBalanceRequired()) {
|
||||
sql = sql + " and gl_j.id in (select t1.id from (select t2.account_id, max(t2.id) as id from "
|
||||
+ "(select id, max(entry_date) as entry_date, account_id from acc_gl_journal_entry where is_running_balance_calculated = 1 "
|
||||
+ "(select id, max(entry_date) as entry_date, account_id from acc_gl_journal_entry where is_running_balance_calculated = true "
|
||||
+ "group by account_id desc, id) t3 inner join acc_gl_journal_entry t2 on t2.account_id = t3.account_id and t2.entry_date = t3.entry_date "
|
||||
+ "group by t2.account_id desc) t1)";
|
||||
}
|
||||
@@ -214,7 +214,7 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
|
||||
final StringBuilder sql = new StringBuilder();
|
||||
sql.append("select ").append(rm.schema());
|
||||
if (associationParametersData.isRunningBalanceRequired()) {
|
||||
sql.append(" and gl_j.is_running_balance_calculated = 1 ");
|
||||
sql.append(" and gl_j.is_running_balance_calculated = true ");
|
||||
}
|
||||
sql.append("where gl.id = ?");
|
||||
if (associationParametersData.isRunningBalanceRequired()) {
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
|
||||
if (onlyManualEntries != null) {
|
||||
if (onlyManualEntries) {
|
||||
sqlBuilder.append(whereClose + " journalEntry.manual_entry = 1");
|
||||
sqlBuilder.append(whereClose + " journalEntry.manual_entry = true");
|
||||
|
||||
whereClose = " and ";
|
||||
}
|
||||
|
||||
+5
-6
@@ -103,7 +103,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
@CronTarget(jobName = JobName.ACCOUNTING_RUNNING_BALANCE_UPDATE)
|
||||
public void updateRunningBalance() {
|
||||
String dateFinder = "select MIN(je.entry_date) as entityDate from acc_gl_journal_entry je "
|
||||
+ "where je.is_running_balance_calculated=0 ";
|
||||
+ "where je.is_running_balance_calculated=false ";
|
||||
try {
|
||||
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class);
|
||||
updateOrganizationRunningBalance(entityDate);
|
||||
@@ -124,7 +124,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
} else {
|
||||
this.officeRepositoryWrapper.findOneWithNotFoundDetection(officeId);
|
||||
String dateFinder = "select MIN(je.entry_date) as entityDate " + "from acc_gl_journal_entry je "
|
||||
+ "where je.is_running_balance_calculated=0 and je.office_id=?";
|
||||
+ "where je.is_running_balance_calculated=false and je.office_id=?";
|
||||
try {
|
||||
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class, officeId);
|
||||
updateRunningBalance(officeId, entityDate);
|
||||
@@ -191,8 +191,8 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
}
|
||||
BigDecimal officeRunningBalance = calculateRunningBalance(entryData, officeRunningBalanceMap);
|
||||
BigDecimal runningBalance = calculateRunningBalance(entryData, runningBalanceMap);
|
||||
String sql = "UPDATE acc_gl_journal_entry je SET je.is_running_balance_calculated=1, je.organization_running_balance="
|
||||
+ runningBalance + ",je.office_running_balance=" + officeRunningBalance + " WHERE je.id=" + entryData.getId();
|
||||
String sql = "UPDATE acc_gl_journal_entry SET is_running_balance_calculated=true, organization_running_balance="
|
||||
+ runningBalance + ",office_running_balance=" + officeRunningBalance + " WHERE id=" + entryData.getId();
|
||||
updateSql.add(sql);
|
||||
batchIndex++;
|
||||
if (batchIndex == batchUpdateSize || index == entryDatas.size() - 1) {
|
||||
@@ -225,8 +225,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
int i = 0;
|
||||
for (JournalEntryData entryData : entryDatas) {
|
||||
BigDecimal runningBalance = calculateRunningBalance(entryData, runningBalanceMap);
|
||||
String sql = "UPDATE acc_gl_journal_entry je SET je.office_running_balance=" + runningBalance + " WHERE je.id="
|
||||
+ entryData.getId();
|
||||
String sql = "UPDATE acc_gl_journal_entry SET office_running_balance=" + runningBalance + " WHERE id=" + entryData.getId();
|
||||
updateSql[i++] = sql;
|
||||
}
|
||||
this.jdbcTemplate.batchUpdate(updateSql);
|
||||
|
||||
+2
-2
@@ -303,9 +303,9 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
final ProductToGLAccountMappingMapper rm = new ProductToGLAccountMappingMapper();
|
||||
String sql = "select " + rm.schema() + " and product_id = ? and mapping.charge_id is not null and charge.is_penalty=";
|
||||
if (penalty) {
|
||||
sql = sql + " 1";
|
||||
sql = sql + " true";
|
||||
} else {
|
||||
sql = sql + " 0";
|
||||
sql = sql + " false";
|
||||
}
|
||||
|
||||
final List<Map<String, Object>> chargeToFundSourceMappingsList = this.jdbcTemplate.query(sql, rm,
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
|
||||
private LoanProductProvisioningEntryMapper() {
|
||||
sqlQuery = new StringBuilder().append(
|
||||
"select if(loan.loan_type_enum=1, mclient.office_id, mgroup.office_id) as office_id, loan.loan_type_enum, pcd.criteria_id as criteriaid, loan.product_id,loan.currency_code,")
|
||||
"select (CASE WHEN loan.loan_type_enum=1 THEN mclient.office_id ELSE mgroup.office_id END) as office_id, loan.loan_type_enum, pcd.criteria_id as criteriaid, loan.product_id,loan.currency_code,")
|
||||
.append("GREATEST(datediff(?")
|
||||
.append(",sch.duedate),0) as numberofdaysoverdue,sch.duedate, pcd.category_id, pcd.provision_percentage,")
|
||||
.append("loan.total_outstanding_derived as outstandingbalance, pcd.liability_account, pcd.expense_account from m_loan_repayment_schedule sch")
|
||||
@@ -110,7 +110,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
@Override
|
||||
public ProvisioningEntryData retrieveProvisioningEntryData(Long entryId) {
|
||||
ProvisioningEntryDataMapperWithSumReserved mapper1 = new ProvisioningEntryDataMapperWithSumReserved();
|
||||
final String sql1 = "select" + mapper1.getSchema() + " where entry.id = ?";
|
||||
final String sql1 = "select" + mapper1.getSchema() + " where entry.id = ? group by entry.id, created.username, modified.username";
|
||||
ProvisioningEntryData data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { entryId });
|
||||
return data;
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
|
||||
|
||||
@Override
|
||||
public Collection<AdHocData> retrieveAllActiveAdHocQuery() {
|
||||
final String sql = "select " + this.adHocRowMapper.schema() + " where r.IsActive = 1 order by r.id";
|
||||
final String sql = "select " + this.adHocRowMapper.schema() + " where r.IsActive = true order by r.id";
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.adHocRowMapper);
|
||||
}
|
||||
|
||||
+2
-2
@@ -441,13 +441,13 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
|
||||
String sql = " SELECT distinct(action_name) as actionName FROM m_permission p ";
|
||||
sql += makercheckerCapabilityOnly(useType, currentUser);
|
||||
sql += " order by if(action_name in ('CREATE', 'DELETE', 'UPDATE'), action_name, 'ZZZ'), action_name";
|
||||
sql += " order by (CASE WHEN action_name in ('CREATE', 'DELETE', 'UPDATE') THEN action_name ELSE 'ZZZ' END), action_name";
|
||||
final ActionNamesMapper mapper = new ActionNamesMapper();
|
||||
final List<String> actionNames = this.jdbcTemplate.query(sql, mapper);
|
||||
|
||||
sql = " select distinct(entity_name) as entityName from m_permission p ";
|
||||
sql += makercheckerCapabilityOnly(useType, currentUser);
|
||||
sql += " order by if(grouping = 'datatable', 'ZZZ', entity_name), entity_name";
|
||||
sql += " order by (CASE WHEN grouping = 'datatable' THEN 'ZZZ' ELSE entity_name END), entity_name";
|
||||
final EntityNamesMapper mapper2 = new EntityNamesMapper();
|
||||
final List<String> entityNames = this.jdbcTemplate.query(sql, mapper2);
|
||||
|
||||
|
||||
+2
-1
@@ -270,7 +270,8 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
||||
List<OfficeData> offices = null;
|
||||
if (officeId == null) {
|
||||
Boolean includeAllOffices = Boolean.TRUE;
|
||||
offices = (List) this.officeReadPlatformService.retrieveAllOffices(includeAllOffices, null);
|
||||
offices = (List) this.officeReadPlatformService.retrieveAllOffices(includeAllOffices, new SearchParameters(null, null, null,
|
||||
null, null, null, null, null, null, "id", "asc", null, null, null, null, null, null));
|
||||
} else {
|
||||
offices = new ArrayList<>();
|
||||
offices.add(this.officeReadPlatformService.retrieveOffice(officeId));
|
||||
|
||||
+1
-1
@@ -248,7 +248,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
|
||||
final ImportTemplateLocationMapper importTemplateLocationMapper = new ImportTemplateLocationMapper();
|
||||
final String sql = "select " + importTemplateLocationMapper.schema();
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, importTemplateLocationMapper, new Object[] { importDocumentId });
|
||||
return this.jdbcTemplate.queryForObject(sql, importTemplateLocationMapper, new Object[] { Integer.parseInt(importDocumentId) });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -253,7 +253,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
|
||||
|
||||
@Override
|
||||
public EmailCampaignData retrieveOne(Long resourceId) {
|
||||
final Integer isVisible = 1;
|
||||
final boolean isVisible = true;
|
||||
try {
|
||||
final String sql = "select " + this.emailCampaignMapper.schema + " where ec.id = ? and ec.is_visible = ?";
|
||||
return this.jdbcTemplate.queryForObject(sql, this.emailCampaignMapper, resourceId, isVisible);
|
||||
@@ -264,7 +264,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
|
||||
|
||||
@Override
|
||||
public Collection<EmailCampaignData> retrieveAllCampaign() {
|
||||
final Integer visible = 1;
|
||||
final boolean visible = true;
|
||||
final String sql = "select " + this.emailCampaignMapper.schema() + " where ec.is_visible = ?";
|
||||
return this.jdbcTemplate.query(sql, this.emailCampaignMapper, visible);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
|
||||
public Collection<EmailCampaignData> retrieveAllScheduleActiveCampaign() {
|
||||
final Integer scheduleCampaignType = EmailCampaignType.SCHEDULE.getValue();
|
||||
final Integer statusEnum = EmailCampaignStatus.ACTIVE.getValue();
|
||||
final Integer visible = 1;
|
||||
final boolean visible = true;
|
||||
final String sql = "select " + this.emailCampaignMapper.schema()
|
||||
+ " where ec.status_enum = ? and ec.campaign_type = ? and ec.is_visible = ?";
|
||||
return this.jdbcTemplate.query(sql, this.emailCampaignMapper, statusEnum, scheduleCampaignType, visible);
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class SmsCampaignReadPlatformServiceImpl implements SmsCampaignReadPlatfo
|
||||
|
||||
@Override
|
||||
public SmsCampaignData retrieveOne(Long campaignId) {
|
||||
final Integer isVisible = 1;
|
||||
final boolean isVisible = true;
|
||||
try {
|
||||
final String sql = "select " + this.smsCampaignMapper.schema + " where sc.id = ? and sc.is_visible = ?";
|
||||
return this.jdbcTemplate.queryForObject(sql, this.smsCampaignMapper, new Object[] { campaignId, isVisible });
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
|
||||
this.context.authenticatedUser();
|
||||
|
||||
final CodeValueDataMapper rm = new CodeValueDataMapper();
|
||||
final String sql = "select " + rm.schema() + "where c.code_name like ? and cv.is_active = 1 order by position";
|
||||
final String sql = "select " + rm.schema() + "where c.code_name like ? and cv.is_active = true order by position";
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] { code });
|
||||
}
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData
|
||||
*/
|
||||
private void handleReportDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dae) {
|
||||
|
||||
if (realCause.getMessage().contains("FOREIGN KEY (`x_registered_table_name`)")) {
|
||||
if (realCause.getMessage().contains("FOREIGN KEY (x_registered_table_name)")) {
|
||||
final String datatableName = command.stringValueOfParameterNamed("datatableName");
|
||||
throw new PlatformDataIntegrityException("error.msg.entityDatatableCheck.foreign.key.constraint",
|
||||
"datatable with name '" + datatableName + "' do not exist", "datatableName", datatableName);
|
||||
|
||||
+2
-2
@@ -217,7 +217,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
return "Table";
|
||||
}
|
||||
|
||||
final String sql = "SELECT ifNull(report_type,'') AS report_type FROM `stretchy_report` WHERE report_name = ? AND self_service_user_report = ?";
|
||||
final String sql = "SELECT coalesce(report_type,'') AS report_type FROM stretchy_report WHERE report_name = ? AND self_service_user_report = ?";
|
||||
|
||||
final String sqlWrapped = this.genericDataService.wrapSQL(sql);
|
||||
|
||||
@@ -460,7 +460,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
private static final class ReportParameterMapper implements RowMapper<ReportParameterData> {
|
||||
|
||||
public String schema() {
|
||||
return "select p.id as id, p.parameter_name as parameterName from stretchy_parameter p where ifnull(p.special,'') != 'Y' order by p.id";
|
||||
return "select p.id as id, p.parameter_name as parameterName from stretchy_parameter p where coalesce(p.special,'') != 'Y' order by p.id";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-3
@@ -268,7 +268,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
// add the registered table to the config if it is a ppi
|
||||
if (this.isSurveyCategory(category)) {
|
||||
this.namedParameterJdbcTemplate
|
||||
.update("insert into c_configuration (name, value, enabled ) values( :dataTableName , '0','0')", paramMap);
|
||||
.update("insert into c_configuration (name, value, enabled ) values( :dataTableName , '0',false)", paramMap);
|
||||
}
|
||||
|
||||
} catch (final JpaSystemException | DataIntegrityViolationException dve) {
|
||||
@@ -481,13 +481,14 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
||||
|
||||
private boolean isRegisteredDataTable(final String name) {
|
||||
// PERMITTED datatables
|
||||
final String sql = "select if((exists (select 1 from x_registered_table where registered_table_name = ?)) = 1, 'true', 'false')";
|
||||
final String sql = "select (CASE WHEN exists (select 1 from x_registered_table where registered_table_name = ?) THEN 'true' ELSE 'false' END)";
|
||||
final String isRegisteredDataTable = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { name });
|
||||
return Boolean.valueOf(isRegisteredDataTable);
|
||||
}
|
||||
|
||||
private void assertDataTableExists(final String datatableName) {
|
||||
final String sql = "select if((exists (select 1 from information_schema.tables where table_schema = schema() and table_name = ?)) = 1, 'true', 'false')";
|
||||
final String sql = "select (CASE WHEN exists (select 1 from information_schema.tables where table_schema = schema()"
|
||||
+ " and table_name = ?) THEN 'true' ELSE 'false' END)";
|
||||
final String dataTableExistsString = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { datatableName });
|
||||
final boolean dataTableExists = Boolean.valueOf(dataTableExistsString);
|
||||
if (!dataTableExists) {
|
||||
|
||||
+3
-3
@@ -65,7 +65,7 @@ public class ReportMailingJobReadPlatformServiceImpl implements ReportMailingJob
|
||||
|
||||
sqlStringBuilder.append("select SQL_CALC_FOUND_ROWS ");
|
||||
sqlStringBuilder.append(mapper.reportMailingJobSchema());
|
||||
sqlStringBuilder.append(" where rmj.is_deleted = 0");
|
||||
sqlStringBuilder.append(" where rmj.is_deleted = false");
|
||||
|
||||
if (searchParameters.isOrderByRequested()) {
|
||||
sqlStringBuilder.append(" order by ").append(searchParameters.getOrderBy());
|
||||
@@ -93,7 +93,7 @@ public class ReportMailingJobReadPlatformServiceImpl implements ReportMailingJob
|
||||
@Override
|
||||
public Collection<ReportMailingJobData> retrieveAllActiveReportMailingJobs() {
|
||||
final ReportMailingJobMapper mapper = new ReportMailingJobMapper();
|
||||
final String sql = "select " + mapper.reportMailingJobSchema() + " where rmj.is_deleted = 0 and is_active = 1"
|
||||
final String sql = "select " + mapper.reportMailingJobSchema() + " where rmj.is_deleted = false and is_active = true"
|
||||
+ " order by rmj.name";
|
||||
|
||||
return this.jdbcTemplate.query(sql, mapper, new Object[] {});
|
||||
@@ -103,7 +103,7 @@ public class ReportMailingJobReadPlatformServiceImpl implements ReportMailingJob
|
||||
public ReportMailingJobData retrieveReportMailingJob(final Long reportMailingJobId) {
|
||||
try {
|
||||
final ReportMailingJobMapper mapper = new ReportMailingJobMapper();
|
||||
final String sql = "select " + mapper.reportMailingJobSchema() + " where rmj.id = ? and rmj.is_deleted = 0";
|
||||
final String sql = "select " + mapper.reportMailingJobSchema() + " where rmj.id = ? and rmj.is_deleted = false";
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, mapper, new Object[] { reportMailingJobId });
|
||||
}
|
||||
|
||||
+9
-9
@@ -171,17 +171,17 @@ public class InteropServiceImpl implements InteropService {
|
||||
private static final class KycMapper implements RowMapper<InteropKycData> {
|
||||
|
||||
public String schema() {
|
||||
return " country.code_value as nationality, c.`date_of_birth` as dateOfBirth, c.`mobile_no` as contactPhone, gender.code_value as gender, c.`email_address` as email, "
|
||||
+ "kyc.code_value as idType, ci.`document_key` as idNo, ci.`description` as description, "
|
||||
return " country.code_value as nationality, c.date_of_birth as dateOfBirth, c.mobile_no as contactPhone, gender.code_value as gender, c.email_address as email, "
|
||||
+ "kyc.code_value as idType, ci.document_key as idNo, ci.`description` as description, "
|
||||
+ "country.code_value as country, a.`address_line_1`, a.`address_line_2`, "
|
||||
+ "a.`city`, state.code_value as stateProvince, a.`postal_code` as postalCode, c.`firstname` as firstName, c.`middlename` as middleName,"
|
||||
+ "c.`lastname` as lastName, c.`display_name` as displayName" + " from " + "m_client c "
|
||||
+ "a.city, state.code_value as stateProvince, a.postal_code as postalCode, c.firstname as firstName, c.middlename as middleName,"
|
||||
+ "c.lastname as lastName, c.display_name as displayName" + " from " + "m_client c "
|
||||
+ "left join m_client_address ca on c.id=ca.client_id " + "left join m_address a on a.id = ca.address_id "
|
||||
+ "inner join m_code_value gender on gender.id=c.`gender_cv_id` "
|
||||
+ "left join m_code_value country on country.id=a.`country_id` "
|
||||
+ "left join m_code_value state on state.id = a.`state_province_id` "
|
||||
+ "left join m_client_identifier ci on c.id=ci.`client_id` "
|
||||
+ "left join m_code_value kyc on kyc.id = ci.`document_type_id` ";
|
||||
+ "inner join m_code_value gender on gender.id=c.gender_cv_id "
|
||||
+ "left join m_code_value country on country.id=a.country_id "
|
||||
+ "left join m_code_value state on state.id = a.state_province_id "
|
||||
+ "left join m_client_identifier ci on c.id=ci.client_id "
|
||||
+ "left join m_code_value kyc on kyc.id = ci.document_type_id ";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class MixTaxonomyReadPlatformServiceImpl implements MixTaxonomyReadPlatfo
|
||||
|
||||
@Override
|
||||
public List<MixTaxonomyData> retrieveAll() {
|
||||
final String sql = "select " + this.mixTaxonomyMapper.schema();
|
||||
final String sql = "select " + this.mixTaxonomyMapper.schema() + " order by id";
|
||||
return this.jdbcTemplate.query(sql, this.mixTaxonomyMapper);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -101,7 +101,7 @@ public class XBRLResultServiceImpl implements XBRLResultService {
|
||||
}
|
||||
|
||||
private String getAccountSql(final Date startDate, final Date endDate) {
|
||||
final String sql = "select debits.glcode as 'glcode', debits.name as 'name', (ifnull(debits.debitamount,0)-ifnull(credits.creditamount,0)) as 'balance' "
|
||||
final String sql = "select debits.glcode as 'glcode', debits.name as 'name', coalesce(debits.debitamount,0)-coalesce(credits.creditamount,0)) as 'balance' "
|
||||
+ "from (select acc_gl_account.gl_code as 'glcode',name,sum(amount) as 'debitamount' "
|
||||
+ "from acc_gl_journal_entry,acc_gl_account " + "where acc_gl_account.id = acc_gl_journal_entry.account_id "
|
||||
+ "and acc_gl_journal_entry.type_enum=2 " + "and acc_gl_journal_entry.entry_date <= " + endDate
|
||||
@@ -118,7 +118,7 @@ public class XBRLResultServiceImpl implements XBRLResultService {
|
||||
// ${branch}=1) "
|
||||
// +
|
||||
+ " group by glcode " + "order by glcode) credits " + "on debits.glcode=credits.glcode " + "union "
|
||||
+ "select credits.glcode as 'glcode', credits.name as 'name', (ifnull(debits.debitamount,0)-ifnull(credits.creditamount,0)) as 'balance' "
|
||||
+ "select credits.glcode as 'glcode', credits.name as 'name', coalesce(debits.debitamount,0)-coalesce(credits.creditamount,0)) as 'balance' "
|
||||
+ "from (select acc_gl_account.gl_code as 'glcode',name,sum(amount) as 'debitamount' "
|
||||
+ "from acc_gl_journal_entry,acc_gl_account " + "where acc_gl_account.id = acc_gl_journal_entry.account_id "
|
||||
+ "and acc_gl_journal_entry.type_enum=2 " + "and acc_gl_journal_entry.entry_date <= " + endDate
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl implement
|
||||
}
|
||||
|
||||
private boolean isAnyLoanProductsAssociateWithThisProvisioningCategory(final Long categoryID) {
|
||||
final String sql = "select if((exists (select 1 from m_loanproduct_provisioning_details lpd where lpd.category_id = ?)) = 1, 'true', 'false')";
|
||||
final String sql = "select (CASE WHEN (exists (select 1 from m_loanproduct_provisioning_details lpd where lpd.category_id = ?)) = 1 THEN 'true' ELSE 'false' END)";
|
||||
final String isLoansUsingCharge = this.jdbcTemplate.queryForObject(sql, String.class, new Object[] { categoryID });
|
||||
return Boolean.valueOf(isLoansUsingCharge);
|
||||
}
|
||||
|
||||
+4
-4
@@ -99,7 +99,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
||||
sqlBuilder.append("s.mobile_no as mobileNo, s.is_active as isActive, s.joining_date as joiningDate ");
|
||||
sqlBuilder.append("from m_office o ");
|
||||
sqlBuilder.append("join m_office ohierarchy on o.hierarchy like concat(ohierarchy.hierarchy, '%') ");
|
||||
sqlBuilder.append("join m_staff s on s.office_id = ohierarchy.id and s.is_active=1 ");
|
||||
sqlBuilder.append("join m_staff s on s.office_id = ohierarchy.id and s.is_active=true ");
|
||||
|
||||
if (loanOfficersOnly) {
|
||||
sqlBuilder.append("and s.is_loan_officer is true ");
|
||||
@@ -175,7 +175,7 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
||||
|
||||
final Long defaultOfficeId = defaultToUsersOfficeIfNull(officeId);
|
||||
|
||||
final String sql = "select " + this.lookupMapper.schema() + " where s.office_id = ? and s.is_active=1 and o.hierarchy like ? ";
|
||||
final String sql = "select " + this.lookupMapper.schema() + " where s.office_id = ? and s.is_active=true and o.hierarchy like ? ";
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { defaultOfficeId, hierarchy });
|
||||
}
|
||||
@@ -242,9 +242,9 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService {
|
||||
// (Both active and Inactive) employees
|
||||
if (status != null) {
|
||||
if (status.equalsIgnoreCase("active")) {
|
||||
extraCriteria.addCriteria(" s.is_active =", 1);
|
||||
extraCriteria.addCriteria(" s.is_active =", true);
|
||||
} else if (status.equalsIgnoreCase("inActive")) {
|
||||
extraCriteria.addCriteria(" s.is_active =", 0);
|
||||
extraCriteria.addCriteria(" s.is_active =", false);
|
||||
} else {
|
||||
if (!status.equalsIgnoreCase("all")) {
|
||||
throw new UnrecognizedQueryParamException("status", status, new Object[] { "all", "active", "inactive" });
|
||||
|
||||
+14
-14
@@ -135,7 +135,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
sqlBuilder.append("t.debit_account_id as debit_account_id, t.credit_account_id as credit_account_id ");
|
||||
sqlBuilder.append("from m_office o ");
|
||||
sqlBuilder.append("join m_office ohierarchy on o.hierarchy like concat(ohierarchy.hierarchy, '%') ");
|
||||
sqlBuilder.append("join m_tellers t on t.office_id = ohierarchy.id and s.is_active=1 ");
|
||||
sqlBuilder.append("join m_tellers t on t.office_id = ohierarchy.id and s.is_active=true ");
|
||||
|
||||
sqlBuilder.append("where o.id = ? ");
|
||||
|
||||
@@ -198,7 +198,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
|
||||
final Long defaultOfficeId = defaultToUsersOfficeIfNull(officeId);
|
||||
|
||||
final String sql = "select " + this.lookupMapper.schema() + " where s.office_id = ? and s.is_active=1 ";
|
||||
final String sql = "select " + this.lookupMapper.schema() + " where s.office_id = ? and s.is_active=true ";
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.lookupMapper, new Object[] { defaultOfficeId });
|
||||
}
|
||||
@@ -529,20 +529,20 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
+ "AND ((case when c.full_day then Date(txn.created_date) between c.start_date AND c.end_date else ( Date(txn.created_date) between c.start_date AND c.end_date"
|
||||
+ " ) and ( TIME(txn.created_date) between TIME(c.start_time) AND TIME(c.end_time)) end) or txn.txn_type = 101)) cashier_txns "
|
||||
+ " union (select " + ctm.savingsTxnSchema()
|
||||
+ " where sav_txn.is_reversed = 0 and c.id = ? and sav.currency_code = ? and o.hierarchy like ? and "
|
||||
+ " where sav_txn.is_reversed = false and c.id = ? and sav.currency_code = ? and o.hierarchy like ? and "
|
||||
+ " sav_txn.transaction_date between c.start_date and date_add(c.end_date, interval 1 day) "
|
||||
+ " and renum.enum_value in ('deposit','withdrawal fee', 'Pay Charge', 'withdrawal', 'Annual Fee', 'Waive Charge', 'Interest Posting', 'Overdraft Interest') "
|
||||
+ " and (sav_txn.payment_detail_id IS NULL OR payType.is_cash_payment = 1) " + " AND acnttrans.id IS NULL ) "
|
||||
+ " and (sav_txn.payment_detail_id IS NULL OR payType.is_cash_payment = true) " + " AND acnttrans.id IS NULL ) "
|
||||
+ " union (select " + ctm.loansTxnSchema()
|
||||
+ " where loan_txn.is_reversed = 0 and c.id = ? and loan.currency_code = ? and o.hierarchy like ? and "
|
||||
+ " where loan_txn.is_reversed = false and c.id = ? and loan.currency_code = ? and o.hierarchy like ? and "
|
||||
+ " loan_txn.transaction_date between c.start_date and date_add(c.end_date, interval 1 day) "
|
||||
+ " and renum.enum_value in ('REPAYMENT_AT_DISBURSEMENT','REPAYMENT', 'RECOVERY_REPAYMENT','DISBURSEMENT', 'CHARGE_PAYMENT', 'WAIVE_CHARGES', 'WAIVE_INTEREST', 'WRITEOFF') "
|
||||
+ " and (loan_txn.payment_detail_id IS NULL OR payType.is_cash_payment = 1) " + " AND acnttrans.id IS NULL ) "
|
||||
+ " and (loan_txn.payment_detail_id IS NULL OR payType.is_cash_payment = true) " + " AND acnttrans.id IS NULL ) "
|
||||
+ " union (select " + ctm.clientTxnSchema()
|
||||
+ " where cli_txn.is_reversed = 0 and c.id = ? and cli_txn.currency_code = ? and o.hierarchy like ? and cli_txn.transaction_date "
|
||||
+ " where cli_txn.is_reversed = false and c.id = ? and cli_txn.currency_code = ? and o.hierarchy like ? and cli_txn.transaction_date "
|
||||
+ " between c.start_date and date_add(c.end_date, interval 1 day) "
|
||||
+ " and renum.enum_value in ('PAY_CHARGE', 'WAIVE_CHARGE') "
|
||||
+ " and (cli_txn.payment_detail_id IS NULL OR payType.is_cash_payment = 1) ) " + " order by created_date ";
|
||||
+ " and (cli_txn.payment_detail_id IS NULL OR payType.is_cash_payment = true) ) " + " order by created_date ";
|
||||
|
||||
if (searchParameters.isLimited()) {
|
||||
sql = sql + " limit " + searchParameters.getLimit();
|
||||
@@ -823,11 +823,11 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
sqlBuilder.append(" left join m_account_transfer_transaction acnttrans ");
|
||||
sqlBuilder.append(" on (acnttrans.from_savings_transaction_id = sav_txn.id ");
|
||||
sqlBuilder.append(" or acnttrans.to_savings_transaction_id = sav_txn.id) ");
|
||||
sqlBuilder.append(" where sav_txn.is_reversed = 0 and c.id = ? ");
|
||||
sqlBuilder.append(" where sav_txn.is_reversed = false and c.id = ? ");
|
||||
sqlBuilder.append(" and sav.currency_code = ? ");
|
||||
sqlBuilder.append(" and o.hierarchy like ? ");
|
||||
sqlBuilder.append(" and sav_txn.transaction_date between c.start_date and date_add(c.end_date, interval 1 day) ");
|
||||
sqlBuilder.append(" and (sav_txn.payment_detail_id IS NULL OR payType.is_cash_payment = 1) ");
|
||||
sqlBuilder.append(" and (sav_txn.payment_detail_id IS NULL OR payType.is_cash_payment = true) ");
|
||||
sqlBuilder.append(" AND acnttrans.id IS NULL ");
|
||||
sqlBuilder.append(" ) ");
|
||||
sqlBuilder.append(" UNION ");
|
||||
@@ -862,11 +862,11 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
sqlBuilder.append(" left join m_account_transfer_transaction acnttrans ");
|
||||
sqlBuilder.append(" on (acnttrans.from_loan_transaction_id = loan_txn.id ");
|
||||
sqlBuilder.append(" or acnttrans.to_loan_transaction_id = loan_txn.id) ");
|
||||
sqlBuilder.append(" where loan_txn.is_reversed = 0 and c.id = ? ");
|
||||
sqlBuilder.append(" where loan_txn.is_reversed = false and c.id = ? ");
|
||||
sqlBuilder.append(" and loan.currency_code = ? ");
|
||||
sqlBuilder.append(" and o.hierarchy like ? ");
|
||||
sqlBuilder.append(" and loan_txn.transaction_date between c.start_date and date_add(c.end_date, interval 1 day) ");
|
||||
sqlBuilder.append(" and (loan_txn.payment_detail_id IS NULL OR payType.is_cash_payment = 1) ");
|
||||
sqlBuilder.append(" and (loan_txn.payment_detail_id IS NULL OR payType.is_cash_payment = true) ");
|
||||
sqlBuilder.append(" AND acnttrans.id IS NULL ");
|
||||
sqlBuilder.append(" ) ");
|
||||
sqlBuilder.append(" UNION ");
|
||||
@@ -896,11 +896,11 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
sqlBuilder.append(" left join m_cashiers c ON c.staff_id = staff.id ");
|
||||
sqlBuilder.append(" left join m_payment_detail payDetails on payDetails.id = cli_txn.payment_detail_id ");
|
||||
sqlBuilder.append(" left join m_payment_type payType on payType.id = payDetails.payment_type_id ");
|
||||
sqlBuilder.append(" where cli_txn.is_reversed = 0 AND c.id = ? ");
|
||||
sqlBuilder.append(" where cli_txn.is_reversed = false AND c.id = ? ");
|
||||
sqlBuilder.append(" and cli_txn.currency_code = ? ");
|
||||
sqlBuilder.append(" and o.hierarchy LIKE ? ");
|
||||
sqlBuilder.append(" and cli_txn.transaction_date between c.start_date and date_add(c.end_date, interval 1 day) ");
|
||||
sqlBuilder.append(" and (cli_txn.payment_detail_id IS NULL OR payType.is_cash_payment = 1) ");
|
||||
sqlBuilder.append(" and (cli_txn.payment_detail_id IS NULL OR payType.is_cash_payment = true) ");
|
||||
sqlBuilder.append(" ) ");
|
||||
sqlBuilder.append(" ) txns ");
|
||||
sqlBuilder.append(" group by cash_txn_type ");
|
||||
|
||||
+3
-3
@@ -258,7 +258,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
|
||||
|
||||
@Override
|
||||
public Collection<Long> fetchPostInterestTransactionIds(final Long accountId) {
|
||||
final String sql = "select att.from_savings_transaction_id from m_account_transfer_transaction att inner join m_account_transfer_details atd on atd.id = att.account_transfer_details_id where atd.from_savings_account_id=? and att.is_reversed =0 and atd.transfer_type = ?";
|
||||
final String sql = "select att.from_savings_transaction_id from m_account_transfer_transaction att inner join m_account_transfer_details atd on atd.id = att.account_transfer_details_id where atd.from_savings_account_id=? and att.is_reversed = false and atd.transfer_type = ?";
|
||||
|
||||
final List<Long> transactionId = this.jdbcTemplate.queryForList(sql, Long.class, accountId,
|
||||
AccountTransferType.INTEREST_TRANSFER.getValue());
|
||||
@@ -268,7 +268,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
|
||||
|
||||
@Override
|
||||
public Collection<Long> fetchPostInterestTransactionIdsWithPivotDate(final Long accountId, final Date pivotDate) {
|
||||
final String sql = "select att.from_savings_transaction_id from m_account_transfer_transaction att inner join m_account_transfer_details atd on atd.id = att.account_transfer_details_id where atd.from_savings_account_id=? and att.is_reversed = 0 and atd.transfer_type = ? and att.transaction_date >= ?";
|
||||
final String sql = "select att.from_savings_transaction_id from m_account_transfer_transaction att inner join m_account_transfer_details atd on atd.id = att.account_transfer_details_id where atd.from_savings_account_id=? and att.is_reversed = false and atd.transfer_type = ? and att.transaction_date >= ?";
|
||||
|
||||
final List<Long> transactionIds = this.jdbcTemplate.queryForList(sql, Long.class, accountId,
|
||||
AccountTransferType.INTEREST_TRANSFER.getValue(), pivotDate);
|
||||
@@ -557,7 +557,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
|
||||
sqlBuilder.append(" from m_account_transfer_details as det ");
|
||||
sqlBuilder.append(" inner join m_account_transfer_transaction as trans ");
|
||||
sqlBuilder.append(" on det.id = trans.account_transfer_details_id ");
|
||||
sqlBuilder.append(" where trans.is_reversed = 0 ");
|
||||
sqlBuilder.append(" where trans.is_reversed = false ");
|
||||
sqlBuilder.append(" and trans.transaction_date = ? ");
|
||||
sqlBuilder.append(" and IF(1=?, det.from_loan_account_id = ?, det.from_savings_account_id = ?) ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user