其他分享
首页 > 其他分享> > mybatis plus & pagehelper

mybatis plus & pagehelper

作者:互联网

pom.xml  ( 注意 pagehelper  exclusions ,不能少)

<!-- mybatis-plus -->
		<dependency>
			<groupId>com.baomidou</groupId>
			<artifactId>mybatis-plus-boot-starter</artifactId>
			<version>3.3.1.tmp</version>
		</dependency>

		<!-- pagehelper  exclusions -->
		<dependency>
			<groupId>com.github.pagehelper</groupId>
			<artifactId>pagehelper-spring-boot-starter</artifactId>
			<version>1.2.3</version>
			<exclusions>
				<exclusion>
					<groupId>org.mybatis</groupId>
					<artifactId>mybatis</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.mybatis</groupId>
					<artifactId>mybatis-spring</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

application.properties

pagehelper.helper-dialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.pageSizeZero=true
pagehelper.params=count=countSql

使用

Ctr.java

PageHelper.startPage(pageNum, 5);

List list = mybatisService.selectList();
	
PageInfo pageInfo = new PageInfo<>(list);

res.put("data", pageInfo);

标签:spring,boot,pagehelper,plus,mybatis,true,pageInfo
来源: https://blog.csdn.net/hongbowu/article/details/121606485