@Test public void all_input_test() { final MeterStatusQueryBuilder meterStatusQueryBuilder = new MeterStatusQueryBuilder(); final MeterStatusGetRequest meterStatusGetRequest = new MeterStatusGetRequest(); meterStatusGetRequest.setCode("1"); meterStatusGetRequest.setIds(Arrays.asList(1L)); meterStatusGetRequest.setMeterStatus("Meter is faulty"); meterStatusGetRequest.setSortBy("status"); meterStatusGetRequest.setSortOrder("desc"); meterStatusGetRequest.setTenantId("default"); assertEquals("Select ms.id as ms_id,ms.code as ms_code," + "ms.status as ms_status,ms.active as ms_active,ms.description as ms_description,ms.createdby as" + " ms_createdby,ms.createddate as ms_createddate,ms.lastmodifiedby as ms_" + "lastmodifiedby,ms.lastmodifieddate as ms_lastmodifieddate,ms.tenantid as" + " ms_tenantid FROM egwtr_meterstatus ms WHERE ms.tenantid = :tenantId AND " + "ms.code = :code AND ms.status = :status AND" + " ms.id IN (:ids) ORDER BY ms.status desc", meterStatusQueryBuilder.getQuery(meterStatusGetRequest, new HashMap<>())); }
public String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder queryString = new StringBuilder(BASE_QUERY); addWhereClause(meterStatusGetRequest, preparedStatementValues, queryString); addOrderByClause(meterStatusGetRequest, queryString); return queryString.toString(); }
MeterStatusQueryBuilder { public String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder queryString = new StringBuilder(BASE_QUERY); addWhereClause(meterStatusGetRequest, preparedStatementValues, queryString); addOrderByClause(meterStatusGetRequest, queryString); return queryString.toString(); } }
MeterStatusQueryBuilder { public String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder queryString = new StringBuilder(BASE_QUERY); addWhereClause(meterStatusGetRequest, preparedStatementValues, queryString); addOrderByClause(meterStatusGetRequest, queryString); return queryString.toString(); }  }
MeterStatusQueryBuilder { public String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder queryString = new StringBuilder(BASE_QUERY); addWhereClause(meterStatusGetRequest, preparedStatementValues, queryString); addOrderByClause(meterStatusGetRequest, queryString); return queryString.toString(); }  String getCreateMeterStatusQuery(); String getUpdateMeterStatusQuery(); String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues); }
MeterStatusQueryBuilder { public String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues) { final StringBuilder queryString = new StringBuilder(BASE_QUERY); addWhereClause(meterStatusGetRequest, preparedStatementValues, queryString); addOrderByClause(meterStatusGetRequest, queryString); return queryString.toString(); }  String getCreateMeterStatusQuery(); String getUpdateMeterStatusQuery(); String getQuery(final MeterStatusGetRequest meterStatusGetRequest, final Map<String, Object> preparedStatementValues); static final String BASE_QUERY; }