Java 在使用@Select遇到的问题:拼接字符串将数组拼为了字符串
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)