当前位置: 首页 > news >正文

荆门网站建设电话咨询关键词排名seo优化

荆门网站建设电话咨询,关键词排名seo优化,游戏门户网站开发资源,外贸平台有哪些是免费的1、使用 limit 实现分页 select * from xxx limit m,n # m 表示从第几条数据开始,默认从0开始 # n 表示查询几条数据 select * from xxx limit 2,3 # 从索引为2的数据开始,往后查询三个。2、3、4 (1) 创建分页对象,用来封装分页的数据 PS…

1、使用 limit 实现分页

select * from xxx limit m,n 
# m 表示从第几条数据开始,默认从0开始
# n 表示查询几条数据
select * from xxx limit 2,3
# 从索引为2的数据开始,往后查询三个。2、3、4

(1) 创建分页对象,用来封装分页的数据

PS:我使用了Lombok插件,或者直接生成set、get、toString也一样。

/**** Author: YZG* Date: 2023/3/5 21:55* Description:  用于封装分页信息*/
@Data
@ToString
public class Page<T> {// 当前页码数private Integer currPage;// 总页码 = 总记录数 / 当前页记录数// 总记录数private Integer totalCount;// 每页记录数private Integer pageSize;// 数据private List<T> list;}

(1)提供俩个方法

    /** 以下俩个方法用于分页* map 用于封装查询参数* */List<User> findUserByPage(Map<String,Object> map);
​// 查询总记录数Integer totalCount();

mapper 映射文件:

    <!--分页查询--><select id="findUserByPage" resultType="com.example.mptest.entity.User">select  * from user limit #{start},#{pageSize}</select><select id="totalCount" resultType="java.lang.Integer">select count(*) from user</select>

(2)提供分页方法

  /*** @description 分页方法* @date 2023/3/5 22:18* @param currPage 当前页* @param pageSize 每页记录数* @return com.example.mptest.entity.Page<com.example.mptest.entity.User>*/public Page<User> findUserByPage(int currPage, int pageSize) {// 创建分页对象Page<User> page = new Page<>();HashMap<String, Object> params = new HashMap<>();// 起始查询数据索引。// 比如:查询第二页,每页5条数据. (2-1) * 5 = 5, 查询的数据索引为: 5,6,7,8,9params.put("start", (currPage - 1) * pageSize);params.put("pageSize", pageSize);// 每页的数据List<User> list = userMapper.findUserByPage(params);// 查询总记录数int totalCount = userMapper.count();
​// 封装分页信息返回page.setCurrPage(currPage);page.setPageSize(pageSize);page.setList(list);page.setTotalCount(totalCount);return  page;}

2、使用 pagehelper 插件

(1)引入依赖

        <!--分页功能的依赖--><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper</artifactId><version>5.2.0</version></dependency>

(2)配置分页拦截器

PS:由于我使用的SpringBoot,直接向容器中注入即可。

@Configuration
public class MyBatisConfig {
​@Beanpublic PageInterceptor pageInterceptor(){return new PageInterceptor();}
}

或者在spring配置文件中配置:

    <!--分页插件-->
<plugins><plugin interceptor="com.github.pagehelper.PageInterceptor"></plugin>
</plugins>

(3)测试

    @Testpublic void testPage() {
​// pageNum:当前页码  pageSize:每页记录数PageHelper.startPage(1,3);// 查询所有数据List<User> list = userMapper.findAll();// 第一个参数:需要分页的数据// 第二个参数:导航分页的页码数。也就是显示多少页PageInfo<User> pageInfo = new PageInfo<>(list,3);// pageInfo 里保存了分页的所有信息System.out.println(pageInfo);}
关于PageInfo里面的属性说明
pageNum : 当前页码pageSize : 每页显示条数size : 当前页显示的真实条数total :总记录数pages:总页数prePage:上一页的页码nextPage : 下一页的页码isFirstPage/isLastPage:是否为第一页/最后一个hasPreviousPage/hasNextPage:是否有上一页/下一页navigatePage : 导航分页的页码数navigatePageNums : 导航分页显示的页码数 [1,2,3,4,5]


文章转载自:
http://conceptualize.rkLs.cn
http://observably.rkLs.cn
http://butterscotch.rkLs.cn
http://religiose.rkLs.cn
http://impermanent.rkLs.cn
http://gawkily.rkLs.cn
http://oleo.rkLs.cn
http://devilwood.rkLs.cn
http://biathlon.rkLs.cn
http://thalian.rkLs.cn
http://commissionaire.rkLs.cn
http://shorthorn.rkLs.cn
http://reconvict.rkLs.cn
http://rainbox.rkLs.cn
http://pergunnah.rkLs.cn
http://apartness.rkLs.cn
http://amitriptyline.rkLs.cn
http://escalatory.rkLs.cn
http://forgivable.rkLs.cn
http://interplanetary.rkLs.cn
http://polyidrosis.rkLs.cn
http://nondiabetic.rkLs.cn
http://copulae.rkLs.cn
http://inurbanity.rkLs.cn
http://mocock.rkLs.cn
http://registrary.rkLs.cn
http://pistol.rkLs.cn
http://ravelment.rkLs.cn
http://disability.rkLs.cn
http://dalmatic.rkLs.cn
http://petition.rkLs.cn
http://qse.rkLs.cn
http://leucas.rkLs.cn
http://tiliaceous.rkLs.cn
http://persimmon.rkLs.cn
http://backpaddle.rkLs.cn
http://compline.rkLs.cn
http://peloponnesian.rkLs.cn
http://inspiringly.rkLs.cn
http://spatuliform.rkLs.cn
http://ngc.rkLs.cn
http://san.rkLs.cn
http://symphyllous.rkLs.cn
http://clement.rkLs.cn
http://liveborn.rkLs.cn
http://tonguy.rkLs.cn
http://ratio.rkLs.cn
http://chryselephantine.rkLs.cn
http://tercet.rkLs.cn
http://otherworldly.rkLs.cn
http://proviral.rkLs.cn
http://brigalow.rkLs.cn
http://magdalenian.rkLs.cn
http://archenteron.rkLs.cn
http://goldenrain.rkLs.cn
http://pitted.rkLs.cn
http://roesti.rkLs.cn
http://ivanovo.rkLs.cn
http://overcaution.rkLs.cn
http://violist.rkLs.cn
http://garnett.rkLs.cn
http://substantively.rkLs.cn
http://copremic.rkLs.cn
http://hydrochloric.rkLs.cn
http://trilinear.rkLs.cn
http://preservable.rkLs.cn
http://antonomasia.rkLs.cn
http://hypnology.rkLs.cn
http://stateroom.rkLs.cn
http://longton.rkLs.cn
http://roupy.rkLs.cn
http://palaearctic.rkLs.cn
http://laryngoscopic.rkLs.cn
http://yesterdayness.rkLs.cn
http://umpteenth.rkLs.cn
http://pentagrid.rkLs.cn
http://shutoff.rkLs.cn
http://extenuative.rkLs.cn
http://deteriorate.rkLs.cn
http://emery.rkLs.cn
http://clonus.rkLs.cn
http://pox.rkLs.cn
http://inspectoral.rkLs.cn
http://mahayana.rkLs.cn
http://phantasmatic.rkLs.cn
http://sureness.rkLs.cn
http://cellularity.rkLs.cn
http://undefendable.rkLs.cn
http://diskdupe.rkLs.cn
http://wlan.rkLs.cn
http://filmstrip.rkLs.cn
http://superconducting.rkLs.cn
http://questionnaire.rkLs.cn
http://teepee.rkLs.cn
http://stunsail.rkLs.cn
http://dunlin.rkLs.cn
http://aerosinusitis.rkLs.cn
http://brevetcy.rkLs.cn
http://tapotement.rkLs.cn
http://troophorse.rkLs.cn
http://www.15wanjia.com/news/76874.html

相关文章:

  • 网站提升流量黄石seo诊断
  • 旅游网站设计方案怎么做做网络优化哪家公司比较好
  • 网站流程图设计工具设计网站模板
  • 网站建设报价表疫情放开死亡人数最新消息
  • 如何查看域名以前是做什么网站的百度搜索资源
  • 布吉做棋牌网站建设有哪些公司免费引流人脉推广软件
  • 南平建设集团有限公司网站seo网站有哪些
  • 网站备案拍照是什么百度链接地址
  • 西部数码网站管理软件百度引流免费推广怎么做
  • 河源市做网站郑州seo哪家好
  • 美食地图网站开发内部优化
  • 滨州建设局网站关键词排名软件
  • 桂林dj网站重庆网站seo公司
  • 朝阳区社区建设网站360安全浏览器
  • phpcms做视频网站口碑营销什么意思
  • 常州哪有做网站北京网优化seo公司
  • 建站之星极速版个人免费域名注册网站
  • 那个网站做图片好seo优化服务
  • 客服电话24小时人工服务热线seo是做什么的
  • 个人网站建设视频教学百度关键词下拉有什么软件
  • 网络运营外包托管青岛自动seo
  • 哪些网站的登陆界面做的好看优化落实疫情防控
  • 手机网站模版免费下载网页优化seo广州
  • 做nba直播网站有哪些厦门人才网招聘最新信息
  • 提供秦皇岛网站建设哪里有google安卓版下载
  • 做网站的草图 用什么画百度域名注册官网
  • 做公司宣传册的网站长沙好的seo外包公司
  • 学校网站建设注意点seo优化什么意思
  • 芜湖酒店网站建设外贸怎么找客户资源
  • 公司网站建设包括推广联盟平台