Spring boot 程序在Controller中传入字符串数组

       我们在使用批量多个数据进行删除的时候会用到数组的情况,因为数组类型可能有int 或者String类型,那我们来看看怎么进行传参。

Controller方法:

Spring boot 程序在Controller中传入字符串数组_第1张图片

对应的 Mapper方法

Spring boot 程序在Controller中传入字符串数组_第2张图片

看看在Mybatis xml配置如下:

  
    delete from test where channel_id in
    
      #{channelId}::uuid
    
  

我们在postman中进行测试验证一下

Spring boot 程序在Controller中传入字符串数组_第3张图片

 多个ID 或者编号请使用逗号进行相应的分隔即可,以上是批量删除信息小例子,希望能帮助到大家。

你可能感兴趣的:(java,java)