mybatis批量对象update更新,不推荐!
实际上是一条一条插入,不要用!更新了1331条数据, 用了5,6分钟,一条一条的入库,害。
serverImpl.java
太慢了,我就注释了。
mapper.java
mapper.xml
<!-- 更新箱数为null的数据 --> <update id="updatePoInfo" parameterType="com.kent.qr.vo.PoTableVO"> update production_order set plant = #{plant}, order_type = #{orderType}, batch_no =#{batchNo}, customer_code = #{customerCode}, customer_name =#{customerName}, material_no = #{materialNo}, mode_no =#{moldNo}, cust_material_no = #{custMaterialNo}, order_qty =#{orderQty}, uom = #{uom}, packing_category =#{packingCategory}, country = #{country}, mpt =#{mpt}, mpq = #{mpq}, mpt_material_no =#{mptMaterialNo}, length = #{length}, width =#{width}, high = #{high}, apt =#{apt}, apq = #{apq}, assortment_id =#{assortmentID}, assortment_description = #{assortmentDescription}, total_carton_qty =#{totalCartonQty}, rel_date =#{relDate}, locco = #{locco}, airplane_type =#{airplaneType}, zscxs = #{zscxs} where production_order in( <foreach collection="poNoList" item="productionOrderNo" separator=","> #{productionOrderNo} </foreach> ) </update>
这个where条件,来源于PoTableVo实体类里面,在第一张图里add进去的。
where
production_order in(
<foreach collection="poNoList" item="productionOrderNo"
separator=",">
#{productionOrderNo}
</foreach>
)
。
有的内容是自己平日积累的与工作上遇到的,有的是摘抄其他博主的精彩好文(会附上作者),愿大家共同成长。