MyBatis paging plug-in PageHelper (Environment is Spring Boot)

Preface: The basic environment is Maven+Spring Boot+Thymeleaf

1. Import dependencies

        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.13</version>
        </dependency>

2.Mapper layer

Query all, the following is the interface method and xml mapping file

Insert picture description here

Insert picture description here

3. Business layer service

Insert picture description here

4. Controller layer

Insert picture description here

5. Front-end paging query

The front end adopts Thymeleaf.
Insert picture description here

Appendix:
This example uses the database table statement:

CREATE TABLE `tb_customer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) DEFAULT NULL COMMENT '姓名',
  `gender` varchar(8) DEFAULT NULL COMMENT '性别',
  `age` int(3) DEFAULT NULL COMMENT '年龄',
  `img` varchar(888) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '头像文件路径及文件名',
  `orig_img` varchar(64) DEFAULT NULL COMMENT '客户上传的原头像的原始名',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Please point out if there are any deficiencies
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44613100/article/details/107892538