sql批量新增,修改

时间:2022-07-09 21:24:32
   <insert id="insertExtDocList" parameterType="map">
INSERT INTO extprjdoc
(docName,createTime,extProjectId)
VALUES
<foreach collection="list" item="item" index="index" separator=","> <!-- list 为传来的集合数据 -->
(#{item.docName},NOW(),#{extProjectId})
</foreach>
</insert> <update id="updateList" parameterType="map">
UPDATE extprjdoc SET sendUnit = #{sendUnit},reveiceUnit = #{reveiceUnit}
WHERE extProjectId IN
<foreach collection="list" item="item" index="index" separator="," open="("
close=")">
#{item}
</foreach>
</update>