您的位置:首页 > 其它

Mybatis 批量增加,批量更新

2015-08-28 15:49 218 查看
<!-- 执行成功返回 增加的记录数   -->

<insert id="insertBatch" parameterType="list" >
insert all
<foreach collection="list" item="CALENDAR" separator=" ">
into  GPTRM_CALENDAR_INFO
( <include refid="Base_Column_List"></include>)
values
(#{CALENDAR.periodno,jdbcType=VARCHAR},   #{CALENDAR.reportingstartdate,jdbcType=VARCHAR})
</foreach>
select 1 from dual
</insert>
<!-- 执行成功返回-1  -->
<update id="updateBatch"  parameterType="java.util.List">
<foreach collection="list" item="item" index="index"  open="begin" close=";end;" separator=";" >
update GPTRM_CONFIG_INFO
set
C_VALUE=#{item.cValue},
MODTIME=#{item.modtime},
MOD_USERID=#{item.modUserid}

where   C_ID = #{item.cId} and FORECAST_TYPE=#{item.forecastType}
</foreach>
</update>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MyBatis批量操作