<update id="updateallByEntity" parameterType="java.util.List">
update T_WEEKDAY
<foreach item="item" index="index" collection="list" open="{" separator="," close="}">
<set>
<if test="item.workflag!=null ">
WORKFLAG=#{item.workflag,jdbcType=DECIMAL},
</if>
<if test="item.updateBy!=null ">
UPDATE_BY=#{item.updateBy,jdbcType=VARCHAR},
</if>
<if test="item.updateDate!=null ">
UPDATE_DATE=#{item.updateDate,jdbcType=TIMESTAMP},
</if>
</set>
<where>
<if test="item.weekdayId!=null ">
WEEKDAY_ID=#{item.weekdayId,jdbcType=DECIMAL},
</if>
</where>
</foreach>
</update>
传入的list的值为:
[{updateBy=21, weekdayId=1, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=1}, {updateBy=21, weekdayId=2, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=1}, {updateBy=21, weekdayId=3, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=1}, {updateBy=21, weekdayId=4, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=1}, {updateBy=21, weekdayId=5, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=1}, {updateBy=21, weekdayId=6, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=0}, {updateBy=21, weekdayId=7, updateDate=Thu Mar 26 22:36:44 CST 2015, workflag=1}]
报错:
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: 出现不支持的 SQL92 标记: 22:
### The error may involve com.bsth.si.mapper.WeekdayMapper.updateallByEntity-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: 出现不支持的 SQL92 标记: 22:
------解决思路----------------------
UPDATE_DATE=#{item.updateDate,jdbcType=TIMESTAMP},
你第12代码多个逗号吧,
直接把sql打印出来确认一下哪的错误