@Test public void both_input_test() { DocumentType documentType = new DocumentType(); documentType.setTenantId("1"); documentType.setApplication(Application.CREATE); Map params = new HashMap(); assertEquals("SELECT * FROM eglams_documenttype documenttype WHERE documenttype.id is not null and documenttype.tenantId = :tenantId and documenttype.application = :application", DocumentTypeQueryBuilder.getDocumentTypeQuery(documentType, params)); params.put(2, params.size()); }
public static String getDocumentTypeQuery(DocumentType documentType, Map params) { StringBuilder baseQuery = new StringBuilder("SELECT * FROM eglams_documenttype documenttype"); if (!(documentType.getApplication() == null && documentType.getTenantId() == null)) { baseQuery.append(" WHERE documenttype.id is not null"); if (documentType.getTenantId() != null) { baseQuery.append(" and documenttype.tenantId = :tenantId"); params.put("tenantId", documentType.getTenantId()); } if (documentType.getApplication() != null) { baseQuery.append(" and documenttype.application = :application"); params.put("application", documentType.getApplication()); } } return baseQuery.toString(); }
DocumentTypeQueryBuilder { public static String getDocumentTypeQuery(DocumentType documentType, Map params) { StringBuilder baseQuery = new StringBuilder("SELECT * FROM eglams_documenttype documenttype"); if (!(documentType.getApplication() == null && documentType.getTenantId() == null)) { baseQuery.append(" WHERE documenttype.id is not null"); if (documentType.getTenantId() != null) { baseQuery.append(" and documenttype.tenantId = :tenantId"); params.put("tenantId", documentType.getTenantId()); } if (documentType.getApplication() != null) { baseQuery.append(" and documenttype.application = :application"); params.put("application", documentType.getApplication()); } } return baseQuery.toString(); } }
DocumentTypeQueryBuilder { public static String getDocumentTypeQuery(DocumentType documentType, Map params) { StringBuilder baseQuery = new StringBuilder("SELECT * FROM eglams_documenttype documenttype"); if (!(documentType.getApplication() == null && documentType.getTenantId() == null)) { baseQuery.append(" WHERE documenttype.id is not null"); if (documentType.getTenantId() != null) { baseQuery.append(" and documenttype.tenantId = :tenantId"); params.put("tenantId", documentType.getTenantId()); } if (documentType.getApplication() != null) { baseQuery.append(" and documenttype.application = :application"); params.put("application", documentType.getApplication()); } } return baseQuery.toString(); }  }
DocumentTypeQueryBuilder { public static String getDocumentTypeQuery(DocumentType documentType, Map params) { StringBuilder baseQuery = new StringBuilder("SELECT * FROM eglams_documenttype documenttype"); if (!(documentType.getApplication() == null && documentType.getTenantId() == null)) { baseQuery.append(" WHERE documenttype.id is not null"); if (documentType.getTenantId() != null) { baseQuery.append(" and documenttype.tenantId = :tenantId"); params.put("tenantId", documentType.getTenantId()); } if (documentType.getApplication() != null) { baseQuery.append(" and documenttype.application = :application"); params.put("application", documentType.getApplication()); } } return baseQuery.toString(); }  static String getDocumentTypeQuery(DocumentType documentType, Map params); }
DocumentTypeQueryBuilder { public static String getDocumentTypeQuery(DocumentType documentType, Map params) { StringBuilder baseQuery = new StringBuilder("SELECT * FROM eglams_documenttype documenttype"); if (!(documentType.getApplication() == null && documentType.getTenantId() == null)) { baseQuery.append(" WHERE documenttype.id is not null"); if (documentType.getTenantId() != null) { baseQuery.append(" and documenttype.tenantId = :tenantId"); params.put("tenantId", documentType.getTenantId()); } if (documentType.getApplication() != null) { baseQuery.append(" and documenttype.application = :application"); params.put("application", documentType.getApplication()); } } return baseQuery.toString(); }  static String getDocumentTypeQuery(DocumentType documentType, Map params);  }