这个貌似mybatis做不到,不过有其他的方法实现相同的效果。例如调用存储过程,级联更新,后台代码实现多表更新等

解决方案 »

  1.   

    把sql语句用“;”分开不就可以了吗!
      

  2.   

    你没有让mysql驱动开启批量执行sql的开关。
     
    怎么开启呢?在拼装mysql链接的url时,为其加上allowMultiQueries参数,设置为true,如下:
     
    jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true
      

  3.   

    <update id="updateLabeledPringStatusBatch"  parameterType="java.util.Map">        update PKP.T_SRV_LABELEDGOOD_TODO 
    <set>
    <if test="operatorTime != null and operatorTime != '' ">
                OPERATE_TIME = #{operatorTime,jdbcType=TIMESTAMP}
    </if>
    </set>        
            <choose>
    <when test="labeledGoodList!= null and labeledGoodList.size>0">
    where id in
    <foreach collection="labeledGoodList" open="(" close=")" separator=","
    item="labeledGoodId">
    <if test="labeledGoodId!=null and labeledGoodId != ''">
               <![CDATA[ #{labeledGoodId,jdbcType=VARCHAR} ]]>
                </if>
    </foreach>
    </when>
    <otherwise>
    where id =''
    </otherwise>
    </choose>
    </update>
      

  4.   

    jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true<delete id="deleteRecipeVideoInfo" parameterType="int">
        delete from tb_parent where id = #{id} ;
        delete from tb_child where pid = #{id}
    </delete>