필립 STAUDT :
다음 Java 클래스를 고려 :
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Document(collection = "Doc")
public class Doc {
@Id
private String id;
private List<String> tags;
}
나는 쿼리 유형 생성 한 QDoc
내가 쉽게 필터에 원하기 때문에 그것을 위해를 대소 문자를 구분 태그 이름.
/**
* QDoc is a Querydsl query type for Doc
*/
@Generated("com.querydsl.codegen.EntitySerializer")
public class QDoc extends EntityPathBase<Doc> {
private static final long serialVersionUID = 602371596L;
private static final PathInits INITS = PathInits.DIRECT2;
public static final QDoc doc = new QDoc("doc");
public final StringPath id = createString("id");
public final ListPath<String, StringPath> tags = this.<String, StringPath>createList("tags", String.class, StringPath.class, PathInits.DIRECT2);
...
}
현재, 나는 수행 하는 경우 민감한 필터링 코드의 다음 줄을 :
QDoc qDoc = QDoc.doc;
BooleanBuilder where = new BooleanBuilder();
where.and(qDoc.tags.contains("Tag name to filter for"));
어떻게 케이스를 구분은에 대해 수행 필터링한다 ListPath<String, StringPath>
?
베스트,
필립
arifng :
당신은을 통해 사례를 구분 데이터를 확인하실 수 있습니다 any()
다음과 같은 방법 :
QDoc qDoc = QDoc.doc;
BooleanBuilder where = new BooleanBuilder();
where.and(qDoc.tags.any().equalsIgnoreCase("Tag name to filter for"));
그것은 나를 위해 작동합니다.