博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MyBatis-Plus 使用总结
阅读量:4203 次
发布时间:2019-05-26

本文共 984 字,大约阅读时间需要 3 分钟。

MP 分页插件

配置类 MybatisPlusConfig

package mybatis.cn.config;import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;/** * @author yanyg * @since 2020/8/19 */@Configurationpublic class MybatisPlusConfig {
/** * mp的分页插件 */ @Bean public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor(); }}

用法

@Testpublic void testSelectByPage() {
System.out.println("===========按条件查询============"); QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("name", "七仙女"); wrapper.orderByAsc("id"); IPage
page = new Page<>(1, 3); IPage
personsIPage = personsMapper.selectPage(page, wrapper); personsIPage.getRecords().forEach(System.out::println); System.out.println("当前分页总页数===>" + personsIPage.getPages()); System.out.println("总条数===>" + personsIPage.getTotal());}

转载地址:http://wfvli.baihongyu.com/

你可能感兴趣的文章
DRM in Android
查看>>
Android 4.4特性说明(持续更新)
查看>>
java基本数据类型
查看>>
a++运算符
查看>>
repo 的一些用法和理解
查看>>
Android如何防止apk程序被反编译
查看>>
如何提高Android代码的安全性
查看>>
Android应用如何实现换肤功能
查看>>
UNIX IO---再谈文件描述符
查看>>
dup,dup2
查看>>
signal(SIGPIPE, SIG_IGN)
查看>>
cc、gcc、g++、CC的区别概括
查看>>
《大话设计模式》之--第1章 代码无错就是优?----简单工厂模式
查看>>
adb 协议
查看>>
android2.3-adb源码分析
查看>>
linux下解压或压缩文件方法
查看>>
如何让新人尽快融入团队
查看>>
Android 4.0新的广播机制FLAG_EXCLUDE_STOPPED_PACKAGES
查看>>
Android 唯一识别码
查看>>
Android之我是ADB
查看>>