spring boot mybatiscodehelper插件和pagehelper插件

1.idea搜索插件MybatisCodeHelper下载

需要激活码https://github.com/gejun123456/MyBatisCodeHelper-Pro

2.右下角插件添加表,选择mapperAnnotation,lombok,Serializable

3.添加方法,直接写方法名,然后全选,右键,generate mybatis xml,自动生成xml方法

具体方法看https://gejun123456.github.io/MyBatisCodeHelper-Pro/#/methodNameToSql

4.pagehelper插件引入

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

5.使用,三个参数分别是第几页,每页几条数据和排序规则

public List<User> bbb(Integer minId,Integer maxId){
   PageHelper.startPage(2,5,"Id asc,Name desc");
   List<User> list = userMapper.findByIdGreaterThanEqualAndIdLessThanEqual(minId,maxId);
   return list;
}

6.在控制台显示sql语句,application.properties里写,com.mapper是你mapper接口所在的位置

mybatis.mapper-locations=classpath:/mapperxml/*Mapper.xml
mybatis.type-aliases-package=com.mapper

logging.level.com.mapper=debug

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值