一、oracle+mybatis执行批量更新:
mapper.xml:
<update id="doupdateBatchResUpStatusById" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
UPDATE EPJT_SBSJ_DBXX
<set>
RES_UP_STATUS=3,
res_local_err_desc=#{item.resLocalErrDesc},
res_local_err_code=#{item.resLocalErrCode},
RES_UP_TIME = #{item.resUpTime}
</set>
where RES_UP_STATUS=1 AND SBSJID = #{item.sbsjid}
</foreach>
</update>
dao接口:
public int doupdateBatchResUpStatusById(List<T> listObject)throws Exception;
二、db2as400+mybatis执行批量更新:
mapper.xml:
<update id="doupdateBatchResUpStatusById" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="BEGIN" close=";END" separator=";" >
UPDATE EPJT_SBSJ_DBXX
<set>
RES_UP_STATUS=3,
<if test="item.resLocalErrDesc != null ">
res_local_err_desc='${item.resLocalErrDesc}',
</if>
<if test="item.resLocalErrCode != null ">
res_local_err_code='${item.resLocalErrCode}',
</if>
RES_UP_TIME = current timestamp
</set>
where RES_UP_STATUS=1 AND SBSJID = ${item.sbsjid}
</foreach>
</update>
dao接口:
public int doupdateBatchResUpStatusById(List<T> listObject)throws Exception;
三、db2aix+mybatis执行批量更新:
mapper.xml:
<update id="doupdateBatchResUpStatusById" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" open="BEGIN" close=";END" separator=";" >
UPDATE EPJT_SBSJ_DBXX
<set>
RES_UP_STATUS=3,
res_local_err_desc=#{item.resLocalErrDesc,jdbcType=VARCHAR},
res_local_err_code=#{item.resLocalErrCode,jdbcType=VARCHAR},
RES_UP_TIME = #{item.resUpTime,jdbcType=DATE}
</set>
where RES_UP_STATUS=1 AND SBSJID = #{item.sbsjid,jdbcType=INTEGER}
</foreach>
</update>
dao接口:
public int doupdateBatchResUpStatusById(List<T> listObject)throws Exception;