批量删除Mybatis

2019-03-22

回顾mybatis批量删除

方法为


public void deleteByIds(Long[] ids);

mapper文件中

<!-- collection可以填的有array list map -->

<delete id="deleteByIds" parameterType="long[]">
  delete from
    tb_brand
    where
    id
    in
    <foreach collection="array" item="ids" index="index" open="(" separator="," close=")">
  #{ids}
  <foreach>
<delete>

评论
发表评论
validate
取消