微信公衆號: 51碼農網
專業編程問答社區
www.51manong.com
數據庫是oracle
1.批量插入數據:java
<insert id="insertData" parameterClass="java.util.List"> insert all <iterate conjunction=""> into tableA(custom,flag) values (#dataList[].custom#,#dataList[].flag#) </iterate> select * from dual </insert>
2.批量刪除數據數據庫
<delete id="insertData" parameterClass="java.util.List"> delete from tableA where custom in <iterate conjunction="," open="(" close=")"> #dataList[].custom# </iterate> </delete>
一次傳入list的數據不要超過1000,用的是in2.批量更新數據
3.批量更新數據編程
<update id="insertData" parameterClass="java.util.List"> update tableA set flag='1' where custom in <iterate conjunction="," open="(" close=")"> #dataList[].custom# </iterate> </update>