package de.flaviait.crud.backoffice.repositories;

import de.flaviait.crud.backoffice.models.PersonDTO;
import de.flaviait.crud.jooq.tables.records.PersonRecord;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

import static de.flaviait.crud.jooq.tables.Person.PERSON;

@Component
public class PersonRepository extends AbstractCRUDRepository<PersonRecord, Long, PersonDTO> {

  @Autowired
  public PersonRepository(DSLContext dslContext) {
    super(dslContext, PERSON, PERSON.ID, PersonDTO.class);
  }

  @Override
  protected Condition filter(Map<String, Object> filterQuery) {
    return PERSON.NAME.likeIgnoreCase("%" + filterQuery.getOrDefault("name", "") + "%");
  }
}

@@ -711,24 +711,68 @@
 terQuery) %7B%0A
+    if(filterQuery.containsKey(%22name%22)) %7B%0A  
     return P
@@ -848,14 +848,73 @@
 + %22%25%22);%0A
+    %7D else %7B%0A      return super.filter(filterQuery);%0A    %7D%0A
   %7D%0A%7D%0A

Improve filtering mechanism