1、遇到错误
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
2、代码写法:
<update id="updateByList" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
UPDATE xxxxx
<set>
<if test="item.user!= null and item.user!=''">
user= #{item.user},
</if>
update_time = #{item.updateTime},
</set>
WHERE
id = #{item.id}
</foreach>
</update>
3、解决办法:重要的事情写三遍
此方式需要允许MySQL的一次执行多条SQL —划重点
url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8&allowMultiQueries=true
此方式需要允许MySQL的一次执行多条SQL —划重点
url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8&allowMultiQueries=true
此方式需要允许MySQL的一次执行多条SQL —划重点
url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf-8&allowMultiQueries=true