<update id="XX" parameterType="list">
update tableName
set
你要修改的数据库字段名称 = CASE 参考的数据库字段名
<foreach collection="list" index="i" item="it" separator=" ">
WHEN #{参考字段参数,jdbcType=参数类型} THEN #{要修改字段的参数,jdbcType=参数类型}
</foreach>
END,<!--多个字段用[,]隔开 END一定不能丢哦-->
你要修改的数据库字段名称 = CASE 参考字段
<foreach collection="list" index="i" item="it" separator=" ">
WHEN #{参考字段参数,jdbcType=参数类型} THEN #{要修改字段的参数,jdbcType=参数类型}
</foreach>
END<!--END一定不能丢哦-->
WHERE 参考的数据库字段名 IN
<foreach collection="list" index="i" item="it" separator="," open="(" close=")">
#{参考字段参数,jdbcType=参数类型}
</foreach>
</update>
mybatis批量update
最新推荐文章于 2023-03-02 12:06:08 发布