PageHelper和mapper4中的selectProvide结合出现两个limit的问题

org.springframework.jdbc.UncategorizedSQLException: 
### Error querying database.  Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, LIMIT LIMIT, pos 47 : select * from syn_test_16044  limit 0,500 LIMIT ? 
### The error may exist in com/whsw/YDataTunnel/mapper/TestMapper.java (best guess)
### The error may involve com.whsw.YDataTunnel.mapper.TestMapper.extractData
### The error occurred while executing a query
### SQL: select * from syn_test_16044  limit 0,500 LIMIT ?
### Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, LIMIT LIMIT, pos 47 : select * from syn_test_16044  limit 0,500 LIMIT ? 
; uncategorized SQLException; SQL state [null]; error code [0]; sql injection violation, syntax error: syntax error, LIMIT LIMIT, pos 47 : select * from syn_test_16044  limit 0,500 LIMIT ? ; nested exception is java.sql.SQLException: sql injection violation, syntax error: syntax error, LIMIT LIMIT, pos 47 : select * from syn_test_16044  limit 0,500 LIMIT ? 
 

 

解决 : pagehelper.supportMethodsArguments=false

supportMethodsArguments:默认值false,分页插件会从查询方法的参数值中,自动根据上面 params 配置的字段中取值,查找到合适的值时就会自动分页。

所以这里的分页需要自己传参的形式实现 : 

@SelectProvider(type = TestDataProvide.class,method = "extractData")
List extractData(@Param("pageNum")Integer pageNum, @Param("pageSize")Integer pageSize);

你可能感兴趣的:(mybatis)