Closed LuciferZK closed 4 years ago
Hi, LuciferZK Please check your usage of mybatis-plus and pagehelper to make sure logic SQL is correct. If your logic SQL doesn't have limit statement, SS can not understand your intentions either.
Hi, your logic SQL is SELECT * FROM
t_dictLIMIT 1,2;
which do not include any sharding key, it should be full table query.
@terrymanu
LuciferZK's doubt is that there is no pagination with pagehelper, when the logic SQL is SELECT dict_id,code,type,value FROM t_dict
.
I ran into the same problem, mybatis plus and pagehelper paging were fine when not using shardingsphere-jdbc, but logicl sql did not have a limit when using it, causing problems with the actual sql
Hello, the problem is that I use the jar package of mybati-plus or pagehelper to integrate with sharding-jdbc to implement the paging function, resulting in a full table query. pom.xml:
application.yml:
Test code snippet:
Console print:
I use pagehelper for pagination,The result is not what I expected. The paging effect was not achieved, but all the queries came out.
Later, I switched to using the pagination api of mybatis-plus.
But when I write sql myself, without using the jar package provided by a third party to integrate with sharding-jdbc, the paging function can be implemented。
@Select("SELECT * FROM
t_dictLIMIT 1,2;") List<Dict> findByPage();
Is sharding-jdbc not compatible with mybatis-plus or pagehelper to achieve paging effect? Or is there something wrong with my code?