Mybatis-核心配置文件
一、核心配置文件常用配置
1、properties标签:该标签可以加载外部的properties文件
2.typeAliases标签:设置类型别名
3.mappers标签:加载映射配置
使用相对于类路径的资源引用,例如:
使用完全限定资源定位符(URL),例如:
使用映射器接口实现类的完全限定类名,例如:
将包内的映射器接口实现全部注册为映射器,例如:
//常用
4.typeHandlers标签
5.plugins标签
1. 导入通用PageHelper坐标
com.github.pagehelper pagehelper 3.7.5 com.github.jsqlparser jsqlparser 0.9.1
2.在mybatis核心配置文件中配置PageHelper插件
3.分页
// 设置分页参数
PageHelper.startPage(1,2);
// 其他分页的数据
PageInfo
System.out.println(" 总条数:"+pageInfo.getTotal());
System.out.println(" 总页数:"+pageInfo.getPages());
System.out.println(" 当前页:"+pageInfo.getPageNum());
System.out.println(" 每页显示长度:"+pageInfo.getPageSize());
System.out.println(" 是否第一页:"+pageInfo.isIsFirstPage());
System.out.println(" 是否最后一页:"+pageInfo.isIsLastPage());