mybatis foreach的一个bug

LittleLeeZi LittleLeeZi 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


如上图,在传入的list中有数据的情况时,没有错误,数据也查出了;
但如果list中有0个数据的话,最终生成的sql是in(),报错了

org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
and ad.ads_is_verify=2
order by rand() limit 0,3' at line 7
...全文

相关推荐

评论 13
收藏 已收藏
分享
返回顶部
LittleLeeZi
Web 开发 81,108 成员 341,721 内容