报错具体信息:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘id’ not found. Available parameters are [ids, param1]
错误代码:
@Delete("delete from users where id in <foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>")
void deleteUsersRoleByIds(@Param("ids") int[] ids) throws Exception;
正确代码:
@Delete({
"<script>",
"delete",
"from users",
"where id in",
"<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
"#{id}",
"</foreach>",
"</script>"
})
void deleteUsersByIds(@Param("ids") int[] ids) throws Exception;