@Select("<script>"+
"select id,authname,permission,uri from auth where id in (select distinct auth_id from role_auth where role_id in " +
" <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>\n" +
" #{item}" +
" </foreach>" +
")" +
"</script>")
List<AuthEntity> selectByRoleIds(@Param("list") List<Long> list);
然后这是报错
SQL: select id,authname,permission,uri from auth where id in (select distinct auth_id from role_auth where role_id in )
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
看下你的list是不是空的