参数page=1,rows=3

错误写法:select   *   from  xxx  limit  #{page},#{rows}

报错:

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 ''1','3'' at line 1

可以看出mybatis自动给我们的参数加了 引号 ' ',所以报错

解决方法:#{}改为${}

正确写法:select   *   from  xxx  limit  ${page},${rows}

Logo

更多推荐