mybatis多参数传递(其中包括数组)

转载地址:https://blog.csdn.net/baochanghong/article/details/51460545

mapper接口的方法:

[java]  view plain  copy
  1. public void batchDelete(@Param(value = "activityId") Integer activityId, @Param(value = "userIds") Integer[] userIds);  

mapper.xml的配置:

[html]  view plain  copy
  1. <insert id="batchDelete">  
  2.      delete from T_ACT_USERS where ACTIVITY_ID = #{activityId}  
  3.      and USER_ID in  
  4.      <foreach collection="userIds" item="item" index="index" open="(" separator="," close=")">  
  5.             #{item}  
  6.      </foreach>  
  7. </insert>  

猜你喜欢

转载自blog.csdn.net/m0_38053538/article/details/80704275
今日推荐