批量update,很简单的sql语句,可是一直在报错。不知道为什么,求助!!!
close="" separator=";">
update student_point_level s
set s.score = #{item.score}
where s.id = #{item.id}
按照打印出来的sql,贴到front里运行的也都是对的....
set s.score = 16
where s.id = 19' at line 7
set s.score = 16
where s.id = 19' at line 7
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 student_point_level s
set s.score = 16
where s.id = 19' at line 7
经过朋友的帮助,此问题已经解决。
参考:http://www.cnblogs.com/hyq0002013/p/6077847.html
把你的xml里面的sql全部贴上来看看
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEmapperPUBLIC"-//mybatis.org//DTDMapper3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<updateid="updateStudentPointLevelBatch"parameterType="java.util.List"><foreachcollection="list"item="item"index="index"open=""close=";"separator=";">updatestudent_point_levelssets.score=#{item.score}wheres.id=#{item.id}</foreach></update><insertid="insertStudentPointLevelBatch">insertintoSTUDENT_POINT_LEVEL(POINT_ID,STUDENT_ID,SCORE,DATETIME)values<foreachcollection="list"item="item"index="index"separator=",">(#{item.pointId},#{item.studentId},#{item.score},now())</foreach></insert>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。