1.批量新增
<insert id="addRcalModelProperty" parameterType="java.util.List" useGeneratedKeys="false"> INSERT INTO T_RCSL_MODEL_PROPERTY ( ID, MODEL_ID, PROPERTY_CODE, PROPERTY_DETAIL_CODE, CREATE_TIME, UPDATE_TIME ) <foreach collection="list" item="item" index="index" separator="union all"> (SELECT #{item.id}, #{item.modelId}, #{item.propertyCode}, #{item.propertyDetailCode}, #{item.createTime}, #{item.updateTime} FROM dual) </foreach> </insert>
2.批量更新
<update id="updateRcalModelProperty" parameterType="java.util.List"> begin <foreach collection="list" item="item" index="index" separator=";" > update T_RCSL_MODEL_PROPERTY <set> <if test="item.id != null and item.id != ''"> id = #{item.id}, </if> <if test="item.modelId != null and item.modelId != ''"> HEAD = #{item.modelId}, </if> </set> where id = #{item.id} </foreach> ;end; </update>
3.批量删除
<delete id="deleteRcalModelProperty" parameterType="java.util.List"> delete from T_RCSL_MODEL_PROPERTY <where> <foreach collection="list" index="index" item="item" open="(" separator="or" close=")"> id = #{item.id} </foreach> </where> </delete>