代码开发分析
在代码开发之前,梳理一下整个程序的执行过程:
-
页面发送Ajax请求,将分页查询参数(page、pageSize、name)提交到服务器
-
服务端Controller接收页面提交的数据并调用Service查询数据
-
Service调用Mapper操作数据库,查询分页数据
-
Controller将查询到的分页数据响应给页面
-
页面接收到分页数据并通过ElementUI的Table组件展示到页面上
分页插件配置类(使用mp)
package com.itheima.reggie.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 配置MP的分页插件
* @author lj
* @create 17:27
*/
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterce

本文介绍了如何使用Mybatis-plus进行分页查询。页面通过Ajax发送请求,携带分页参数到服务器。服务端Controller接收数据,调用Service查询数据库。Service利用Mapper查询分页数据,然后返回给页面,最终通过ElementUI的Table组件展示。
最低0.47元/天 解锁文章
2914

被折叠的 条评论
为什么被折叠?



