在Spring data jpa里使用jpql联表查询,如何进行条件判断

新手上路,请多包涵

在dao里面我是这样写的

@Query(value = "select new com.bali.school.vo.CourseOrderVO(c.courseName,c.url,c.price,o.endDate) from CourseOrder o,CourseInfo c where o.userId=?1 and o.payState=?2 and o.endDate >= ?3 and c.courseId=o.courseId")
List<CourseOrderVO> findOrders(Long uid, int state, Timestamp date);

传入三个值进行查询,在其中一个没有值的情况下,不生成该条件,应该如何做到

阅读 3.2k
1 个回答
推荐问题