/**
* 批量更新userId
* @param userIdMap
*/
//该注解解决报错Failed to process, please exclude the tableName or statementId问题。
@SqlParser(filter = true)
void updateByMap(@Param("userIdMap") Map<Long, Long> userIdMap);
<update id="updateByMap" parameterType="java.util.Map">
update staff_info set
user_id =
case id
<foreach collection="userIdMap.entrySet()" item="value" index="key">
when #{key} then #{value}
</foreach>
end
</update>
懒得打字,就这样吧。