I spent almost two hours trying various methods. Later I thought that the amount of data after filtering by where did not reach the default number of one page, so I simply did not display the limit information in where. After trying it, it was indeed the case. . . The author really made the program smart enough, but this intelligence also made me waste two hours in vain. . . Or maybe I am just too stupid... But the strange thing is that if I don't set the QueryWrapper parameter, the paging limit after where can be seen again. I can't figure out what the author is thinking. . . See the code for details: @Override public PageUtils queryPage(Map<String, Object> params) { IPage<OrderEntity> page = this.page( new Query<OrderEntity>().getPage(params), new QueryWrapper<OrderEntity>().eq(!UtilString.isNull(params.get("user_id")) ,"user_id", params.get("user_id")) ); return new PageUtils(page); } The purpose of recording is to hope that friends who encounter this special situation like me can quickly bypass this corner, time is precious. Good night^.^ Finally, I attach the official document. I hope you can read the document more systematically. https://mp.baomidou.com/guide/dynamic-datasource.html Supplementary knowledge: Record the pit of limit failure of mybatisplus paging method generated by reverse engineering Because before I solved the problem, I also searched for solutions on the Internet and the official website, but there was no solution, so this is why I wrote this article, hoping Students who come after you can avoid detours when developing Controller layer @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = categoryService.queryPage(params); return R.ok().put("page", page); } The parameters passed are as shown in the figure Server interface public interface CategoryService extends IService<CategoryEntity> { PageUtils queryPage(Map<String, Object> params); } Problem and solution (this is the solution on the Internet and it has not been solved...) However, when querying, the paging does not take effect, and the query result is all the data in the table. If the pom is correct, check whether the paging interceptor is injected into spring. import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class mybatisPlusConfig { @Bean public PaginationInterceptor paginationInterceptor(){ return new PaginationInterceptor(); } } The above is the solution I found on the Internet. I copied it into the project and found that the method is outdated and does not work. Later I found that the problem was that my mybatisplus version was too high, so it was not supported This is the version I referenced in Maven Then search the interceptor method on the Internet The problem is solved by using a new paging method The key to the problem is how to find the problem fundamentally. For me, I reflected on the method of finding the problem, so that I would not waste 1 or 2 hours today without finding it. I would go to the official documentation first. Check out the official example code! ! ! ! ! ! The following is the reverse engineering I found on gitee Because the project schedule is very tight, and I have a headache looking at my colleague's old framework code, wouldn't it be great to choose reverse engineering and build a lightweight framework by myself? Because the project uses springcloud microservices, I am responsible for a system so I can do whatever I want. The reverse engineering I use here is the renren-generator framework on gitee There is no interceptor for the paging method in the code he generated. I found that the method on the official website is also outdated, which is very pitfall. The above article about mybatis-plus paging and sql where condition without limit paging information operation is all I want to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
>>: Example of Html shielding right-click menu and left-click typing function
A set of projects for training react+ts Although ...
Knowledge point 1: Set the base URL of the web pa...
The overall architecture of NGINX is characterize...
First we create the database table: CREATE TABLE ...
Because springboot has a built-in tomcat server, ...
This case is based on CentOS 7 system Suitable fo...
When doing a project, it is inevitable to encount...
We use the translate parameter to achieve movemen...
*******************Introduction to HTML language (...
This article example shares the specific code of ...
1. Introduction After MySQL is started, BufferPoo...
Table of contents 1. Implementation process of qu...
This article mainly involves solutions to problem...
Table of contents v-model .sync The difference in...