批量插入xml
<insert id="batchSaves" useGeneratedKeys="true" keyProperty="relId" parameterType="java.util.List" >
insert into categorys_display_mapping (rel_id, display_category_code, display_category_name,
category_code, status, create_oper_id,
create_time, update_oper_id, update_time,
remark, first_cate_code, first_cate_name,
second_cate_code, second_cate_name, ext_json
) values
<foreach collection="list" item="item" separator=",">
(#{item.relId,jdbcType=BIGINT}, #{item.displayCategoryCode,jdbcType=VARCHAR}, #{item.displayCategoryName,jdbcType=VARCHAR},
#{item.categoryCode,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, #{item.createOperId,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateOperId,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.remark,jdbcType=VARCHAR}, #{item.firstCateCode,jdbcType=VARCHAR}, #{item.firstCateName,jdbcType=VARCHAR},
#{item.secondCateCode,jdbcType=VARCHAR}, #{item.secondCateName,jdbcType=VARCHAR}, #{item.extJson,jdbcType=LONGVARCHAR}
)
</foreach>
</insert>
批量修改
<update id="batchUpdates" parameterType="list">
<foreach collection="list" item="item" separator=";">
UPDATE categorys_display_mapping
<set>
<if test="item.displayCategoryCode != null">
displayCategoryCode = #{item.displayCategoryCode},
</if>
<if test="item.displayCategoryName != null">
displayCategoryName = #{item.displayCategoryName},
</if>
<if test="item.categoryCode != null">
categoryCode = #{item.categoryCode},
</if>
<if test="item.status != null">
status = #{item.status},
</if>
<if test="item.createOperId != null">
createOperId = #{item.createOperId},
</if>
<if test="item.createTime != null">
createTime = #{item.createTime},
</if>
<if test="item.updateOperId != null">
updateOperId = #{item.updateOperId},
</if>
<if test="item.updateTime != null">
updateTime = #{item.updateTime},
</if>
<if test="item.remark != null">
remark = #{item.remark},
</if>
<if test="item.firstCateCode != null">
firstCateCode = #{item.firstCateCode},
</if>
<if test="item.firstCateName != null">
firstCateName = #{item.firstCateName},
</if>
<if test="item.secondCateCode != null">
secondCateCode = #{item.secondCateCode},
</if>
<if test="item.secondCateName != null">
secondCateName = #{item.secondCateName},
</if>
<if test="item.extJson != null">
extJson = #{item.extJson},
</if>
</set>
WHERE rel_id = #{categorys_display_mapping.rel_id}
</foreach>
</update>