@Test public void all_input_test() { final MeterCostQueryBuilder meterCostQueryBuilder = new MeterCostQueryBuilder(); final MeterCostGetRequest meterCostGetRequest = new MeterCostGetRequest(); meterCostGetRequest.setActive(true); meterCostGetRequest.setCode("MC"); meterCostGetRequest.setIds(Arrays.asList(1L, 2L)); meterCostGetRequest.setMeterMake("MeterMake"); meterCostGetRequest.setSortBy("code"); meterCostGetRequest.setSortOrder("desc"); meterCostGetRequest.setTenantId("default"); assertEquals( "Select wmc.id as wmc_id,wmc.code as wmc_code," + "wmc.metermake as wmc_metermake,wmc.amount as wmc_amount," + "wmc.active as wmc_active,wmc.createdby as wmc_createdby,wmc.createddate as wmc_createddate," + "wmc.lastmodifiedby as wmc_lastmodifiedby,wmc.lastmodifieddate as wmc_lastmodifieddate," + "wmc.tenantid as wmc_tenantid from egwtr_metercost wmc WHERE wmc.tenantId = :tenantId AND " + "wmc.code = :code AND wmc.metermake = :metermake AND wmc.active = :active AND" + " wmc.id IN (:ids) ORDER BY wmc.code desc", meterCostQueryBuilder.getQuery(meterCostGetRequest, new HashMap<>())); }
@SuppressWarnings("rawtypes") public String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); addWhereClause(selectQuery, meterCostGetRequest, preparedStatementValues); addOrderByClause(selectQuery, meterCostGetRequest); return selectQuery.toString(); }
MeterCostQueryBuilder { @SuppressWarnings("rawtypes") public String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); addWhereClause(selectQuery, meterCostGetRequest, preparedStatementValues); addOrderByClause(selectQuery, meterCostGetRequest); return selectQuery.toString(); } }
MeterCostQueryBuilder { @SuppressWarnings("rawtypes") public String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); addWhereClause(selectQuery, meterCostGetRequest, preparedStatementValues); addOrderByClause(selectQuery, meterCostGetRequest); return selectQuery.toString(); }  }
MeterCostQueryBuilder { @SuppressWarnings("rawtypes") public String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); addWhereClause(selectQuery, meterCostGetRequest, preparedStatementValues); addOrderByClause(selectQuery, meterCostGetRequest); return selectQuery.toString(); }  @SuppressWarnings("rawtypes") String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues); String insertMeterCostQuery(); String updateMeterCostQuery(); String selectMeterCostByNameAndTenantIdQuery(); String selectMeterCostByNameTenantIdAndCodeNotInQuery(); }
MeterCostQueryBuilder { @SuppressWarnings("rawtypes") public String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); addWhereClause(selectQuery, meterCostGetRequest, preparedStatementValues); addOrderByClause(selectQuery, meterCostGetRequest); return selectQuery.toString(); }  @SuppressWarnings("rawtypes") String getQuery(final MeterCostGetRequest meterCostGetRequest, final Map<String, Object> preparedStatementValues); String insertMeterCostQuery(); String updateMeterCostQuery(); String selectMeterCostByNameAndTenantIdQuery(); String selectMeterCostByNameTenantIdAndCodeNotInQuery(); static final String BASE_QUERY; }