<!--myabtis中的写法,并未测试-->
<update id="sada">
update consumer set
names=case id
<foreach collection="list" item="namea" index="index">
<choose>
<when test="names!=null">
when #{id} then #{names}
</when>
<otherwise>
</otherwise>
</choose>
</foreach>
end,
loginName=case id
<foreach collection="list" item="nameb" index="index">
<choose>
<when test="names!=null">
when #{id} then #{loginName}
</when>
<otherwise>
</otherwise>
</choose>
</foreach>
end
<where>
id in
<foreach collection="list" item="id" index="index" open="("
separator="," close=")">
#{id}
</foreach>
</where>
</update>
mybatis多个更新,也适用导入表
最新推荐文章于 2024-08-13 16:22:34 发布