报错截图:
解决方案:
方法一:
将collection改为array,以下在mapper.xml(根据自己定义的xml文件修改,这里小编定义的是mapper)文件下修改
mapper.xml:
<!-- 批量删除-->
<delete id="deleteByIds">
delete from tb_brand where id in
<foreach collection="array" item="id" separator="," open="(" close= ")">
#{id}
</foreach>
;
</delete>
mapper.java:
//批量删除
void deleteByIds(int[] ids);
方法二:
用Param注解改变mapper里面的名称,以下在mapper.java(根据自己定义的java文件修改,这里小编定义的是mapper)文件下修改
mapper.java:
//批量删除
void deleteByIds(@Param("ids") int[] ids);
mapper.xml:
<!-- 批量删除-->
<delete id="deleteByIds">
delete from tb_brand where id in
<foreach collection="ids" item="id" separator="," open="(" close= ")">
#{id}
</foreach>
;
</delete>