@TraceCall @Override public RecordSet getPages(Context ctx, long[] pageIds) { RecordSet pageRecs = new RecordSet(); if (ArrayUtils.isNotEmpty(pageIds)) { String sql = new SQLBuilder.Select() .select(StringUtils2.splitArray(BASIC_COLS, ",", true)) .from(pageTable) .where( "destroyed_time=0 AND page_id IN (${page_ids})", "page_ids", StringUtils2.join(pageIds, ",")) .toString(); SQLExecutor se = getSqlExecutor(); se.executeRecordSet(sql, pageRecs); attachBasicInfo(ctx, pageRecs); } return pageRecs; }
@TraceCall @Override public RecordSet searchPages(Context ctx, String kw, int page, int count) { String skw = "%" + ObjectUtils.toString(kw) + "%"; String sql = new SQLBuilder.Select() .select("page_id") .from(pageTable) .where( "destroyed_time=0 AND (name LIKE ${v(kw)} OR name_en LIKE ${v(kw)}) OR address LIKE ${v(kw)} OR address_en LIKE ${v(kw)}", "kw", skw) .page(page, count) .toString(); SQLExecutor se = getSqlExecutor(); RecordSet pageIdRecs = se.executeRecordSet(sql, null); long[] pageIds = CollectionUtils2.toLongArray(pageIdRecs.getIntColumnValues("page_id")); return getPages(ctx, pageIds); }