一个表有多个key,而且想要通过传list批量更新或删除时可以仿照以下mybatis
//接口类:
int rejectBatch(List<InfoKey> keyList);
///mapper.xml:
<update id="rejectBatch" parameterType="com.workmaster.pojo.InfoKey" >
update info
set res = 3
where <foreach collection="list" item="item" open="(" separator="or" close=")">
uid = #{item.uid,jdbcType=INTEGER} and username = #{item.username,jdbcType=CHAR}
</foreach>
</update>
foreach就是循环拼接,collection是传入类型,item单个元素,open和close就是每个foreach替换后前后加的符号,separator是foreach间加的符号
举个例子
update info
set res = 3
where (uid=1 and username = 123) or (uid=2 and username =234)
其实就是最终会拼成正常的sql