请帮助我编写以下spring数据jpa

请帮助我编写以下spring数据jpa,spring,spring-boot,spring-data,spring-data-jpa,Spring,Spring Boot,Spring Data,Spring Data Jpa,我想写这样的东西: find where player id = ?1 && (lastspinneddate < ?2 || lastspinneddate == null) repo.findByPlayerIdAndLastSpinnedDateBeforeOrLastSpinnedDateIsNull(playerId,startOfDay); find where (player id = ?1 && lastspinneddate <

我想写这样的东西:

find where player id = ?1 && (lastspinneddate < ?2 || lastspinneddate == null)
repo.findByPlayerIdAndLastSpinnedDateBeforeOrLastSpinnedDateIsNull(playerId,startOfDay);
find where (player id = ?1 && lastspinneddate < ?2) || lastspinneddate == null
,但这是不正确的,其返回方式如下:

find where player id = ?1 && (lastspinneddate < ?2 || lastspinneddate == null)
repo.findByPlayerIdAndLastSpinnedDateBeforeOrLastSpinnedDateIsNull(playerId,startOfDay);
find where (player id = ?1 && lastspinneddate < ?2) || lastspinneddate == null
查找位置(玩家id=?1&&lastspinneddate<?2)| | lastspinneddate==null

请帮我写上面的spring数据jpa,提前谢谢你

@Query("select p from Player p where p.id = ?1 && (p.lastSpinnedDate < ?2 or p.lastSpinnedDate is null)")
@Query(“从播放器p中选择p,其中p.id=?1&&(p.lastSpinnedDate<?2或p.lastSpinnedDate为空)”)

感谢您的回复,但我们不能不写@Query吗?我想知道spring数据jpa有多强大和灵活?对于非常简单的情况,自动生成查询很好。它不应该避免尽可能多的手工查询。该方法的可怕名称本身表明您应该指定一个查询。如何在@query中检查null,它表示意外标记“null”我的查询缺少一个结束括号。我修好了。我不知道你的问题是否在这里。发布它,并发布完整的异常堆栈跟踪。您是否查看过QueryDSL或规范API?