mybaits 批量 update

发儿娃 2016-09-27 08:13:45
传入一个 list集合 List下面是 实体类的集合
<update id="updateWagesFrame"  parameterType="java.util.List">
<foreach collection="list" item="info" index="index" open="" close="" separator=";">
update abc
<set>
<if test="info.userId != null and info.userId != ''">
UserId = #{info.userId},
</if>
<if test="info.departmentId != null and info.departmentId != ''">
DepartmentId = #{info.departmentId},
</if>
<if test="info.departmentId != null and info.departmentId != ''">
DepartmentId = #{info.departmentId},
</if>
<if test="info.userName != null and info.userName != ''">
UserName = #{info.userName},
</if>
<if test="info.type != null and info.type != ''">
Type = #{info.type},
</if>
<if test="info.value != null and info.value != ''">
Value = #{info.value},
</if>
<if test="info.updateDate != null and info.updateDate != ''">
UpdateDate = #{info.updateDate},
</if>
<if test="info.updateByUserId != null and info.updateByUserId != ''">
UpdateByUserId = #{info.updateByUserId},
</if>
</set>
where UserId = ${info.userId}
</foreach>
</update>


运行后报错为:
Handler processing failed; nested exception is java.lang.Error: Unresolved compilation problems:
List cannot be resolved to a variable
Syntax error on token "info", delete this token

各位大神 麻烦帮个小忙。。。
...全文
49 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧