限制
属性不支持嵌套或者分组约束,比如这样的查询 firstname = ?0 or (firstname = ?1 and lastname = ?2)
灵活匹配只支持字符串类型,其他类型只支持精确匹配
总结
通过在使用springdata jpa时可以通过Example来快速的实现动态查询,同时配合Pageable可以实现快速的分页查询功能。
对于非字符串属性的只能精确匹配,比如想查询在某个时间段内注册的用户信息,就不能通过Example来查询
TableColumnsConfig tableColumnsConfig = TableColumnsConfig.builder()
.tableName("t_user_info")
.userId(userId)
.auth("no")
.build();
ExampleMatcher example = ExampleMatcher.matchingAll();
List<TableColumnsConfig> tableColumnsCon = tableColumnsConfigDao.findAll(Example.of(tableColumnsConfig
, example));