mybatis批量更新,foreach标签问题

图片说明
mapper里面代码,用的foreach标签

        <foreach collection="list" item="item"  open="(" close=")" separator=";">
            update delivery
            <set> state = "2"</set>
             <where> id = ${item}</where>
        </foreach>

报错

图片说明

图片说明

org.springframework.jdbc.BadSqlGrammarException: 
### Error updating database.  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 'update delivery
             SET state = "2" 
              WHERE id = 22 
     ' at line 2
### The error may involve com.bishe.dao.CompanyHandller.updateState-Inline
### The error occurred while setting parameters
### SQL: (               update delivery              SET state = "2"                WHERE id = 22           )
### 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 'update delivery
             SET state = "2" 
              WHERE id = 22 
     ' at line 2
; bad SQL grammar []; nested exception is 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 'update delivery
             SET state = "2" 
              WHERE id = 22 
     ' at line 2

不要括号

<foreach collection="list" item="item"  open="" close=";" separator=";">

separator=";"改成separator=","试试

这个问题去掉括号试一下呢