Java再用@Select拼接sql語句時候,
#{參數名}:是加引號的
${參數名}:是不加引號的
例如:
userIds為List或者數組,值為1,2,3,4,5
1.@Select("select * from users where userId in (#{userIds})")
翻譯為sql語句之后為:select * from users where userId in ('1,2,3,4,5')
2.@Select("select * from users where userId in (${userIds})")
翻譯為sql語句之后為:select * from users where userId in (1,2,3,4,5)