spring-data-jpa

ExampleMatcher matcher = ExampleMatcher.matching()
  .withMatcher("firstname", endsWith())
  .withMatcher("lastname", startsWith().ignoreCase());
}

 

StringMatcher options
Matching Logical result

DEFAULT (case-sensitive)

firstname = ?0

DEFAULT (case-insensitive)

LOWER(firstname) = LOWER(?0)

EXACT (case-sensitive)

firstname = ?0

EXACT (case-insensitive)

LOWER(firstname) = LOWER(?0)

STARTING (case-sensitive)

firstname like ?0 + '%'

STARTING (case-insensitive)

LOWER(firstname) like LOWER(?0) + '%'

ENDING (case-sensitive)

firstname like '%' + ?0

ENDING (case-insensitive)

LOWER(firstname) like '%' + LOWER(?0)

CONTAINING (case-sensitive)

firstname like '%' + ?0 + '%'

CONTAINING (case-insensitive)

LOWER(firstname) like '%' + LOWER(?0) + '%'

 

				// 起始日期
				if (startTime != null) {
					predicate.getExpressions()
							.add(cb.greaterThanOrEqualTo(root.get("lastLogin").as(Date.class), startTime));
				}
				// 结束日期
				if (endTime != null) {
					predicate.getExpressions().add(cb.lessThanOrEqualTo(root.get("lastLogin").as(Date.class), endTime));
				}

 

 

你可能感兴趣的:(java)