mybatis接收数组参数foreach

接口参数

public Integer selectDefectCount(@Param("trainId") String trainId,@Param("pids") String[] pids);

 

XML文件

<if test="pids != null">
     and defect.pid in
  <foreach collection="pids" item="pid" open="(" separator="," close=")">
  #{pid}
  </foreach>
</if>

posted @ 2022-09-16 09:26  northli  阅读(269)  评论(0编辑  收藏  举报