首先,在dao接口层方法上加上Param注解
public int test(@Param("set") Set<String> recordIds);
不加注解,会报错!
接着,在mybatis mapper文件中添加
<update id="test" parameterType="java.util.Set" >
update 表名 sr
set sr.status = 1
where sr.status = 0
and sr.record_id in
<foreach collection="set" item="item"
open="(" separator="," close=")">
#{item}
</foreach>
</update>