本篇是基于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&#