Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mybatis or limit to achieve paging

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use mybatis or limit to achieve paging function", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to use mybatis or limit to achieve paging function" this article bar.

1. Limit implementation paging

1.1 Why pagination is needed to reduce data throughput

1.2 Paging with Limit

select * from user limit startIndex,pageSize; #Note is query pageSize from startIndex+1 select * from user limit 3; # [0,3]

1.3 Pagination using mybatis (core:SQL)

1.3.1 Interface

UserMapper.java

// limit implementation Pagination Map can only be followed by Integer wrapper class can not int List getUserByLimit(Map map);

1.3.2 UserMapper.xml

select * from mybatis.user limit #{statrIndex},#{pageSize};

1.3.3 Test classes

UserMapperTest.java

select * from `mybatis`.` user` limit #{startIndex},#{pageSize}; select * from `mybatis`.` user` where id = #{id}; The above is "how to use mybatis or limit to achieve paging function" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report