MyBatis批量删除报SQL语法错误

xml的代码

<delete id="deleteByIds"  parameterType = "java.util.List">
        DELETE FROM user WHERE id IN
        <foreach collection="list"  item="item" open="(" separator="," close=")"  >
                 #{item}
        </foreach>
    </delete>

控制台的信息

DELETE FROM user WHERE id IN          (                    ?          )
### Cause: java.sql.SQLSyntaxErrorException: 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 ''1184303620793794562'
         )' at line 3

我postman传的是{"deleteIds":["1184303620793794562"]},但在控制台出现 ''1184303620793794562' 很莫名其妙

阅读 3.2k
1 个回答

id 太大???

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题