官网文档:https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#query-by-example.usage
Person person = new Person(); person.setFirstname("Dave"); ExampleMatcher matcher = ExampleMatcher.matching() .withIgnorePaths("lastname") .withIncludeNullValues() .withStringMatcherEnding(); Example<Person> example = Example.of(person, matcher)
Example 103. Configuring matcher options
Example 103. Configuring matcher options ExampleMatcher matcher = ExampleMatcher.matching() .withMatcher("firstname", endsWith()) .withMatcher("lastname", startsWith().ignoreCase()); }
Example 104. Configuring matcher options with lambdas
ExampleMatcher matcher = ExampleMatcher.matching() .withMatcher("firstname", match -> match.endsWith()) .withMatcher("firstname", match -> match.startsWith()); }
来源:https://www.cnblogs.com/lshan/p/12018313.html