@Test public void test_query_with_acknowlegement() { NoticeCriteria noticeCriteria = new NoticeCriteria(); noticeCriteria.setAcknowledgementNumber("ack"); Map params = new HashMap(); assertEquals(getQueryWithCriteria(noticeCriteria), NoticeQueryBuilder.getNoticeQuery(noticeCriteria, params)); assertEquals(1, params.size() - 2); }
@SuppressWarnings("unchecked") public static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params) { StringBuilder selectQuery = new StringBuilder("SELECT * FROM eglams_notice notice"); selectQuery.append(" WHERE notice.id is not null"); if (noticeCriteria.getId() != null) { selectQuery.append("and notice.id IN (:noticeId)"); params.put("noticeId", noticeCriteria.getId()); } if (noticeCriteria.getAgreementNumber() != null) { selectQuery.append(" and notice.agreementno = :agreementNumber"); params.put("agreementNumber", noticeCriteria.getAgreementNumber()); } if (noticeCriteria.getAcknowledgementNumber() != null) { selectQuery.append(" and notice.acknowledgementnumber = :ackNumber"); params.put("ackNumber", noticeCriteria.getAcknowledgementNumber()); } if (noticeCriteria.getAssetCategory() != null) { selectQuery.append(" and notice.assetcategory = :assetCategory"); params.put("assetCategory", noticeCriteria.getAssetCategory()); } if (noticeCriteria.getNoticeNo() != null) { selectQuery.append(" and notice.noticeno = :noticeNo"); params.put("noticeNo", noticeCriteria.getNoticeNo()); } if (noticeCriteria.getNoticeType() != null) { selectQuery.append(" and notice.noticetype = :noticeType"); params.put("noticeType", noticeCriteria.getNoticeType()); } if (noticeCriteria.getRevenueWard() != null) { selectQuery.append(" and notice.ward = :revenueWard"); params.put("revenueWard", noticeCriteria.getRevenueWard()); } if (noticeCriteria.getAssetNo() != null) { selectQuery.append(" and notice.assetno = :assetNo"); params.put("assetNo", noticeCriteria.getAssetNo()); } if (noticeCriteria.getTenantId() != null) { selectQuery.append(" and notice.tenantid = :tenantId"); params.put("tenantId", noticeCriteria.getTenantId()); } selectQuery.append(" ORDER BY notice.ID"); selectQuery.append(" LIMIT :pageSize"); if (noticeCriteria.getSize() != null) params.put("pageSize", noticeCriteria.getSize()); else params.put("pageSize", 20); selectQuery.append(" OFFSET :pageNumber"); if (noticeCriteria.getOffset() != null) params.put("pageNumber", noticeCriteria.getOffset()); else params.put("pageNumber", 0); return selectQuery.toString(); }
NoticeQueryBuilder { @SuppressWarnings("unchecked") public static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params) { StringBuilder selectQuery = new StringBuilder("SELECT * FROM eglams_notice notice"); selectQuery.append(" WHERE notice.id is not null"); if (noticeCriteria.getId() != null) { selectQuery.append("and notice.id IN (:noticeId)"); params.put("noticeId", noticeCriteria.getId()); } if (noticeCriteria.getAgreementNumber() != null) { selectQuery.append(" and notice.agreementno = :agreementNumber"); params.put("agreementNumber", noticeCriteria.getAgreementNumber()); } if (noticeCriteria.getAcknowledgementNumber() != null) { selectQuery.append(" and notice.acknowledgementnumber = :ackNumber"); params.put("ackNumber", noticeCriteria.getAcknowledgementNumber()); } if (noticeCriteria.getAssetCategory() != null) { selectQuery.append(" and notice.assetcategory = :assetCategory"); params.put("assetCategory", noticeCriteria.getAssetCategory()); } if (noticeCriteria.getNoticeNo() != null) { selectQuery.append(" and notice.noticeno = :noticeNo"); params.put("noticeNo", noticeCriteria.getNoticeNo()); } if (noticeCriteria.getNoticeType() != null) { selectQuery.append(" and notice.noticetype = :noticeType"); params.put("noticeType", noticeCriteria.getNoticeType()); } if (noticeCriteria.getRevenueWard() != null) { selectQuery.append(" and notice.ward = :revenueWard"); params.put("revenueWard", noticeCriteria.getRevenueWard()); } if (noticeCriteria.getAssetNo() != null) { selectQuery.append(" and notice.assetno = :assetNo"); params.put("assetNo", noticeCriteria.getAssetNo()); } if (noticeCriteria.getTenantId() != null) { selectQuery.append(" and notice.tenantid = :tenantId"); params.put("tenantId", noticeCriteria.getTenantId()); } selectQuery.append(" ORDER BY notice.ID"); selectQuery.append(" LIMIT :pageSize"); if (noticeCriteria.getSize() != null) params.put("pageSize", noticeCriteria.getSize()); else params.put("pageSize", 20); selectQuery.append(" OFFSET :pageNumber"); if (noticeCriteria.getOffset() != null) params.put("pageNumber", noticeCriteria.getOffset()); else params.put("pageNumber", 0); return selectQuery.toString(); } }
NoticeQueryBuilder { @SuppressWarnings("unchecked") public static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params) { StringBuilder selectQuery = new StringBuilder("SELECT * FROM eglams_notice notice"); selectQuery.append(" WHERE notice.id is not null"); if (noticeCriteria.getId() != null) { selectQuery.append("and notice.id IN (:noticeId)"); params.put("noticeId", noticeCriteria.getId()); } if (noticeCriteria.getAgreementNumber() != null) { selectQuery.append(" and notice.agreementno = :agreementNumber"); params.put("agreementNumber", noticeCriteria.getAgreementNumber()); } if (noticeCriteria.getAcknowledgementNumber() != null) { selectQuery.append(" and notice.acknowledgementnumber = :ackNumber"); params.put("ackNumber", noticeCriteria.getAcknowledgementNumber()); } if (noticeCriteria.getAssetCategory() != null) { selectQuery.append(" and notice.assetcategory = :assetCategory"); params.put("assetCategory", noticeCriteria.getAssetCategory()); } if (noticeCriteria.getNoticeNo() != null) { selectQuery.append(" and notice.noticeno = :noticeNo"); params.put("noticeNo", noticeCriteria.getNoticeNo()); } if (noticeCriteria.getNoticeType() != null) { selectQuery.append(" and notice.noticetype = :noticeType"); params.put("noticeType", noticeCriteria.getNoticeType()); } if (noticeCriteria.getRevenueWard() != null) { selectQuery.append(" and notice.ward = :revenueWard"); params.put("revenueWard", noticeCriteria.getRevenueWard()); } if (noticeCriteria.getAssetNo() != null) { selectQuery.append(" and notice.assetno = :assetNo"); params.put("assetNo", noticeCriteria.getAssetNo()); } if (noticeCriteria.getTenantId() != null) { selectQuery.append(" and notice.tenantid = :tenantId"); params.put("tenantId", noticeCriteria.getTenantId()); } selectQuery.append(" ORDER BY notice.ID"); selectQuery.append(" LIMIT :pageSize"); if (noticeCriteria.getSize() != null) params.put("pageSize", noticeCriteria.getSize()); else params.put("pageSize", 20); selectQuery.append(" OFFSET :pageNumber"); if (noticeCriteria.getOffset() != null) params.put("pageNumber", noticeCriteria.getOffset()); else params.put("pageNumber", 0); return selectQuery.toString(); }  }
NoticeQueryBuilder { @SuppressWarnings("unchecked") public static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params) { StringBuilder selectQuery = new StringBuilder("SELECT * FROM eglams_notice notice"); selectQuery.append(" WHERE notice.id is not null"); if (noticeCriteria.getId() != null) { selectQuery.append("and notice.id IN (:noticeId)"); params.put("noticeId", noticeCriteria.getId()); } if (noticeCriteria.getAgreementNumber() != null) { selectQuery.append(" and notice.agreementno = :agreementNumber"); params.put("agreementNumber", noticeCriteria.getAgreementNumber()); } if (noticeCriteria.getAcknowledgementNumber() != null) { selectQuery.append(" and notice.acknowledgementnumber = :ackNumber"); params.put("ackNumber", noticeCriteria.getAcknowledgementNumber()); } if (noticeCriteria.getAssetCategory() != null) { selectQuery.append(" and notice.assetcategory = :assetCategory"); params.put("assetCategory", noticeCriteria.getAssetCategory()); } if (noticeCriteria.getNoticeNo() != null) { selectQuery.append(" and notice.noticeno = :noticeNo"); params.put("noticeNo", noticeCriteria.getNoticeNo()); } if (noticeCriteria.getNoticeType() != null) { selectQuery.append(" and notice.noticetype = :noticeType"); params.put("noticeType", noticeCriteria.getNoticeType()); } if (noticeCriteria.getRevenueWard() != null) { selectQuery.append(" and notice.ward = :revenueWard"); params.put("revenueWard", noticeCriteria.getRevenueWard()); } if (noticeCriteria.getAssetNo() != null) { selectQuery.append(" and notice.assetno = :assetNo"); params.put("assetNo", noticeCriteria.getAssetNo()); } if (noticeCriteria.getTenantId() != null) { selectQuery.append(" and notice.tenantid = :tenantId"); params.put("tenantId", noticeCriteria.getTenantId()); } selectQuery.append(" ORDER BY notice.ID"); selectQuery.append(" LIMIT :pageSize"); if (noticeCriteria.getSize() != null) params.put("pageSize", noticeCriteria.getSize()); else params.put("pageSize", 20); selectQuery.append(" OFFSET :pageNumber"); if (noticeCriteria.getOffset() != null) params.put("pageNumber", noticeCriteria.getOffset()); else params.put("pageNumber", 0); return selectQuery.toString(); }  @SuppressWarnings("unchecked") static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params); static String getRentDueSearchQuery(DueSearchCriteria dueCriteria, Map<String, Object> params); static String getDueNoticesQuery(DueNoticeCriteria noticeCriteria, Map<String, Object> params); }
NoticeQueryBuilder { @SuppressWarnings("unchecked") public static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params) { StringBuilder selectQuery = new StringBuilder("SELECT * FROM eglams_notice notice"); selectQuery.append(" WHERE notice.id is not null"); if (noticeCriteria.getId() != null) { selectQuery.append("and notice.id IN (:noticeId)"); params.put("noticeId", noticeCriteria.getId()); } if (noticeCriteria.getAgreementNumber() != null) { selectQuery.append(" and notice.agreementno = :agreementNumber"); params.put("agreementNumber", noticeCriteria.getAgreementNumber()); } if (noticeCriteria.getAcknowledgementNumber() != null) { selectQuery.append(" and notice.acknowledgementnumber = :ackNumber"); params.put("ackNumber", noticeCriteria.getAcknowledgementNumber()); } if (noticeCriteria.getAssetCategory() != null) { selectQuery.append(" and notice.assetcategory = :assetCategory"); params.put("assetCategory", noticeCriteria.getAssetCategory()); } if (noticeCriteria.getNoticeNo() != null) { selectQuery.append(" and notice.noticeno = :noticeNo"); params.put("noticeNo", noticeCriteria.getNoticeNo()); } if (noticeCriteria.getNoticeType() != null) { selectQuery.append(" and notice.noticetype = :noticeType"); params.put("noticeType", noticeCriteria.getNoticeType()); } if (noticeCriteria.getRevenueWard() != null) { selectQuery.append(" and notice.ward = :revenueWard"); params.put("revenueWard", noticeCriteria.getRevenueWard()); } if (noticeCriteria.getAssetNo() != null) { selectQuery.append(" and notice.assetno = :assetNo"); params.put("assetNo", noticeCriteria.getAssetNo()); } if (noticeCriteria.getTenantId() != null) { selectQuery.append(" and notice.tenantid = :tenantId"); params.put("tenantId", noticeCriteria.getTenantId()); } selectQuery.append(" ORDER BY notice.ID"); selectQuery.append(" LIMIT :pageSize"); if (noticeCriteria.getSize() != null) params.put("pageSize", noticeCriteria.getSize()); else params.put("pageSize", 20); selectQuery.append(" OFFSET :pageNumber"); if (noticeCriteria.getOffset() != null) params.put("pageNumber", noticeCriteria.getOffset()); else params.put("pageNumber", 0); return selectQuery.toString(); }  @SuppressWarnings("unchecked") static String getNoticeQuery(NoticeCriteria noticeCriteria, @SuppressWarnings("rawtypes") Map params); static String getRentDueSearchQuery(DueSearchCriteria dueCriteria, Map<String, Object> params); static String getDueNoticesQuery(DueNoticeCriteria noticeCriteria, Map<String, Object> params); static final Logger logger; static final String INSERT_NOTICE_QUERY; static final String INSERT_DUE_NOTICE_QUERY; final static String SEQ_NOTICE_NO; final static String SEQ_NOTICE_ID; final static String RENTINCREMENTTYPEQUERY; final static String RENT_DUE_QUERY; final static String RENT_DUE_GROUP_BY; static final String RENT_DUE_OUTER_QUERY_GROUP_BY; }