利用mybatis的RowBounds实现分页

这篇博客介绍了如何在SpringBoot项目中利用Mybatis的RowBounds实现分页功能。内容包括工程结构展示、配置文件(.yml)的使用、DeptMapper接口及对应的DeptMapper.xml映射文件设置、DeptService服务层的常量建立、DeptController控制器的实现,以及最终的页面显示效果。
摘要由CSDN通过智能技术生成

本篇是基于springboot框架下做的分页,利用mybatis逆向工程生成映射文件
1.工程结构
在这里插入图片描述
2.配置文件采用.yml

#数据库连接信息
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/his
    username: root
    password: itcast

mybatis:
  #配置包别名
  type-aliases-package: com.cry.his_1.domain
  #配置映射文件位置
  mapper-locations: classpath:mapper/*.xml

2.com.cry.his_1.dao.DeptMapper

 //全表查询,使用分页,分页插件
    List<Dept> selectAll(RowBounds rowBounds);
    //获取记录数(有查询条件或者没有查询条件的)
    int selectRecordCount(Dept dept);

3.DeptMapper.xml

<select id="selectAll" resultType="com.cry.his_1.domain.Dept">
    select * from dept
  </select>
  <select id="selectRecordCount" parameterType="dept" resultType="int&#
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值