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