记录一下,以免忘记
mapper.xml文件
<update id="updateByArrayId">
update table as a
set a.is_delete = 1
where a.id in
<foreach collection="ids" open="(" item="ids" separator="," close=")" index="index">
#{ids}
</foreach>
</update>
Dao层:
void updateByArrayId(@Param("ids") Integer[] ids);
如果采用这种写法,一定要在service层对ids非空进行判断,否则的话SQL会报错。