一、最简单的for循环(不推荐,数据量小可以接受)
二、sql,如果是in的这种都可以用sql去解决
<delete id="batchDeleteAmrtIr">
DELETE FROM TTRD_ACCTG_SECU_OBJ_RECILE
<where>
<if test="ids != null and ids.size() != 0 ">
AND ID IN
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item,jdbcType=VARCHAR}
</foreach>
</if>
</where>
</delete>
二、不能用in的要考虑jdbc或者整个sql语句的操作
1,修改可以使用jdbcTemplate的batchUpdate方法
JSONArray jsonArray = new JSONArray();
for(String str : areaList.split(",")){
JSONObject jsonObject = new JSONObject();
jsonObject.put("0", str);
jsonArray.add(jsonObject);
}
List<Object[]> batchArgs = BaseUtil.batchArgs(jsonArray);
int [] result = DataSourceUtil.getJdbcTemplate().batchUpdate("delete from tamlregionblacklist where c_code = ? ", batchArgs);
2,或者用原始的jdbc操作
https://blog.csdn.net/lihao97049855/article/details/50614863?winzoom=1
或者整个语句