需要在地址后面添加开启批量更新:allowMultiQueries=true
url:jdbc:mysql://${SystemParameter.dbaddr}:${SystemParameter.dbport}/e9?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=true&&allowMultiQueries=true
批量更新: 前提要设置允许批量更新<上面的设置>
<update id="updateTaxClassfiyCodes" parameterType="java.util.List">
<foreach collection="lists" item="item" index="index" open="" close="" separator=";">
UPDATE invoice_tax_ClassificationCode
<set>
<if test="item.taxRate!=null and item.taxRate !=''"> taxRate =#{item.taxRate}, </if>
<if test="item.productName != null and item.productName != ''">productName =#{item.productName}, </if>
<if test="item.productAbbreviatio != null and item.productAbbreviatio != ''"> productAbbreviatio=#{item.productAbbreviatio}, </if>
<if test="item.privilege!=null and item.privilege!=''"> privilege=#{item.privilege}, </if>
<if test="item.keyword != null and item.keyword != ''">keyword=#{item.keyword}, </if>
<if test="item.explain!= null and item.explain != ''"> `explain`=#{item.explain},</if>
<if test="item.ismergesuperior != null and item.ismergesuperior != ''">ismergesuperior=#{item.ismergesuperior}</if>
</set>
WHERE mergeCode = #{item.mergeCode}
</foreach>
</update>
批量插入
<insert id="insertTaxClassfiyCodes" parameterType="java.util.List">
INSERT INTO invoice_tax_ClassificationCode(pirce,kind,chapter,konb,strip,sincere,nape,eye,`specific`,detail,mergeCode,taxRate,productName,productAbbreviatio,privilege,keyword,`explain`,ismergesuperior)VALUES
<foreach collection="lists" item="item" index="index" separator=",">
(#{item.pirce},#{item.kind},#{item.chapter},#{item.konb},#{item.strip},#{item.sincere},#{item.nape},#{item.eye},#{item.specific},#{item.detail},#{item.mergeCode},#{item.taxRate},#{item.productName},#{item.productAbbreviatio},#{item.privilege},#{item.keyword},#{item.explain},#{item.ismergesuperior})
</foreach>
</insert>