- 2023-07-24 12:13:17
- 5087 热度
- 0 评论
用两个字符串对比,如果不一致则为我要的结果,我是这样写的:
// 语句 @Query("select t from UrlTaskBase t where t.backStr<>t.okMark and t.tryCount<=2")
发现没有查询出来数据,后来发现,如果该字段为Null时,则判断无法通过。
所以必须增加该字段是否为Null的判断:
修改为:
// 语句 @Query("select t from UrlTaskBase t where (t.backStr is null or t.backStr!=t.okMark) and t.tryCount<=2")
注意,这里是SpringJPA里面的写法,SQL语句也是一样的。
0 评论
留下评论