代码
mapper
/**
* 批量修改
* @param updateList
* @return
*/
int updateBatch(@Param("list") List<SjbdZjbQtbt> updateList);
}
xml
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="updateList" index="index" open="begin" close=";end;" separator=";">
UPDATE SJBD_ZJB_QTBT
<set>
<if test="updateList.btnd != null">
BTND = #{updateList.btnd,jdbcType=VARCHAR},
</if>
<if test="updateList.zzjgid != null">
ZZJGID = #{updateList.zzjgid,jdbcType=VARCHAR},
</if>
<if test="updateList.xm != null">
XM = #{updateList.xm,jdbcType=VARCHAR},
</if>
<if test="updateList.bzhm != null">
BZHM = #{updateList.bzhm,jdbcType=VARCHAR},
</if>
<if test="updateList.rybs != null">
RYBS = #{updateList.rybs,jdbcType=VARCHAR},
</if>
<if test="updateList.sfjf != null">
SFJF = #{updateList.sfjf,jdbcType=VARCHAR},
</if>
<if test="updateList.btjgfk != null">
BTJGFK = #{updateList.btjgfk,jdbcType=VARCHAR},
</if>
<if test="updateList.btxq != null">
BTXQ = #{updateList.btxq,jdbcType=VARCHAR},
</if>
<if test="updateList.btje != null">
BTJE = #{updateList.btje,jdbcType=DECIMAL},
</if>
<if test="updateList.jfje != null">
JFJE = #{updateList.jfje,jdbcType=DECIMAL},
</if>
<!--<if test="updateList.csrq != null">
CSRQ = #{updateList.csrq,jdbcType=TIMESTAMP},
</if>
<if test="updateList.csr != null">
CSR = #{updateList.csr,jdbcType=VARCHAR},
</if>-->
<if test="updateList.btffrq != null">
BTFFRQ = #{updateList.btffrq,jdbcType=TIMESTAMP},
</if>
<if test="updateList.btffzt != null">
BTFFZT = #{updateList.btffzt,jdbcType=VARCHAR},
</if>
<if test="updateList.grzhid != null">
GRZHID = #{updateList.grzhid,jdbcType=VARCHAR},
</if>
</set>
WHERE
ZJBQTBTID = #{updateList.zjbqtbtid,jdbcType=VARCHAR}
</foreach>
</update>
拼装updateList
for (int i = 0; i < intersectList.size(); i++) {
SjbdZjbQtbt sjbdZjbQtbt = (SjbdZjbQtbt) intersectList.get(i);
sjbdZjbQtbt.setBtffzt("0");
sjbdZjbQtbt.setBtjgfk("1");
sjbdZjbQtbt.setBtxq("8");
updateList.add(sjbdZjbQtbt);
}