jpa 按语法自定义命名
对应数据库,in查询
例1
public interface DcTotalAgreementRepository extends JpaRepository<Agreement, Long>, JpaSpecificationExecutor<Agreement> {
List<Agreement> findByIdIn(Long[] ids);
}
例2
public interface CredentialsRepository extends JpaRepository<Credentials, Long>, JpaSpecificationExecutor<Credentials> {
List<AAA> findByTotalAgreementIdIn(List<String> ids);
}
引用
List<Agreement> agreements = dcTotalAgreementRepository.findByIdIn(ids);
List<AAA> credentials = credentialsRepository.findByTotalAgreementIdIn(agreementIds);
命名规则: