<statement> or DELIMITER expected,got ‘id‘

Mybatis 自动生成xml文件的sql报错:<statement> or DELIMITER expected,got ‘id‘

解决方式,依次点击:File -> settings -> Editor -> Language Injections

如图所示:

image-20260420201532121

找到:xml:MyBatis,把MyBatis 中的 sql给删掉,如图所示:

image-20260420201759206

就可以解决报错。