给Spring Data传入一个样本数据,Spring Data就能从数据库中查询出和样本相同的数据。 被查询的数据并不需要和样本是完全相同的,可能只需要和样本有几个属性是相同的。 总结: 样本查询–就是把参数作为样本去查询数据库的数据,根据自定义的匹配规则,如果对应上就能把数据查出来 样本查询也可以定义其中查询的一些匹配规则 ▲ 样本查询的API(QueryByExampleExecutor): JpaRepository继承了QueryByExampleExecutor接口,该接口提供了如下“样本查询”方法: - <S extends T> Optional<S> findOne(Example<S> example); - <S extends T> Iterable<S> findAll(Example<S> example); - <S extends T> Iterable<S> findAll(Example<S> example, Sort sort); - <S extends T> Page<S> findAll(Example<S> example,...