我试图请求从数据库中获取数据
参数中包含三个选项的布尔值:
的选项
但我不知道如何处理null
@Repository
public interface Repo extends ReactiveCrudRepository<Device,Long> {
@Query("SELECT * FROM device where user_id = $1 and show = $2")
Flux<Device> findByUserIdAndShow(String userId, Boolean show);
}发布于 2022-10-26 22:44:00
@Query("SELECT * FROM device where user_id = $1 and ($2 is null or show = $2)")https://stackoverflow.com/questions/74214705
复制相似问题