DefaultModelQueryExecutor extends ModelExecutorBase implements ModelQueryExecutor { @Override public QueryListResult queryList(QueryOptions options, Map<String, Object> filters, Consumer<CriteriaQuery> callback) { return queryList(options, filters, callback, filterByParams); } DefaultModelQueryExecutor(ModelExecutorContext context);  DefaultModelQueryExecutor(ModelExecutorContext context, ModelQueryExtension ex); @Override ModelQueryExecutor withFindHandler(FindHandler handler); @Override ModelQueryExecutor withListeners(EntityListeners listeners); @Override ModelQueryExecutor fromSqlView(String sql); @Override ModelQueryExecutor fromSqlView(String sql, Map<String, Object> params); @Override ModelQueryExecutor selectExclude(String... names); @Override ModelQueryExecutor setFilterByParams(boolean filterByParams); @Override QueryOneResult queryOne(Object id, QueryOptionsBase options); @Override QueryOneResult queryOneByKey(Map<String, Object> key, QueryOptionsBase options); @Override QueryListResult queryList(QueryOptions options, Map<String, Object> filters, Consumer<CriteriaQuery> callback); @Override QueryListResult queryList(QueryOptions options, Map<String, Object> filters, Consumer<CriteriaQuery> callback, boolean filterByParams); @Override QueryListResult count(CountOptions options, Consumer<CriteriaQuery> callback); void calcIdsByEmbeddedField(Set<Object> ids, Record record, String embeddedFieldName);  }
@Test public void testFilters() { DefaultModelQueryExecutor executor = newExecutor(Author.class); QueryOptions options = new QueryOptions(); options.setFilters("info like %guangzhou%"); List<Record> authors = executor.queryList(options).getList(); assertEquals(1, authors.size()); assertEquals("none", authors.get(0).get("info", AuthorInfo.class).getAddress()); options.clearResolved(); options.setFilters("not (name eq Author1)"); authors = executor.queryList(options).getList(); assertEquals(1, authors.size()); assertEquals("Author2", authors.get(0).getString("name")); }
@Test public void testManyToOneJoinAndFilter() { DefaultModelQueryExecutor executor = newExecutor(Book.class); QueryOptions options = new QueryOptions(); assertEquals(2, executor.queryList(options).list.size()); options.clearResolved(); options.setJoins("author a"); options.setFilters("a.name eq 'not exists'"); assertEquals(0, executor.queryList(options).list.size()); options.clearResolved(); options.setFilters("a.name eq 'Author1'"); List<Record> records = executor.queryList(options).list; assertEquals(1, records.size()); assertEquals("book1", records.get(0).getString("title")); options.clearResolved(); options.setFilters("a.name eq 'Author2'"); records = executor.queryList(options).list; assertEquals(1, records.size()); assertEquals("book2", records.get(0).getString("title")); }