条件批量(场景比如多个用户批量修改用户名,,这样举例比较好理解,这个场景真实情况下不会存在)
<update id = "userName">
update user
<set>
<if>
user_name = #{userName,jdbcType=TINYINT},
</if>
updated_date = now()
</set>
where user_id = #{userId}
<if test="actNos !=null and actNos.size>0">
and user_name in
<foreach collection ="userNames" items="name" separator="," close=")" open="(">
#{userName,jdbcType = VARCHAR}
</foreach>
<if>
</update>