<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>
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>
怎么开启呢?在拼装mysql链接的url时,为其加上allowMultiQueries参数,设置为true,如下:
jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true
<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>
delete from tb_parent where id = #{id} ;
delete from tb_child where pid = #{id}
</delete>