D small classroom -SpringBoot 2.x micro-channel pay online educational website project combat _3-5.PageHelper pagination plug-in uses

notes


5, PageHelper tab Plugins
    Introduction: explain open assembly, using tabs mybaits plug

        1 is introduced dependent
            <- - widget dependent tab!>
            <Dependency>
                <the groupId> com.github.pagehelper </ the groupId>
                <the artifactId> pagehelper </ the artifactId>
                <Version> 4.1.0 </ Version>
            </ dependency>

        2, increasing the profile
                @Configuration
            public class MyBatisConfig {
                @Bean
                public pageHelper pageHelper () {
                    pageHelper pageHelper new new pageHelper = ();
                    the Properties new new P = the Properties ();
                    p.setProperty ( "offsetAsPageNum","true");
                    p.setProperty ( "rowBoundsWithCount", "to true");
                    p.setProperty ( "Reasonable", "to true");
                    pageHelper.setProperties (P);
                    return pageHelper;
                }
            }

        . 3, packaging
                PageHelper.startPage (page, size) ;

                PageInfo <VideoOrder> PageInfo new new PageInfo = <> (List);


        . 4, the basic principle    
            sqlsessionFactory -> sqlSession-> executor -> mybatis sql statement
            by increasing interceptor mybatis plugin, and tab assembly
            org.apache.ibatis.plugin.Interceptor
 

Start

General sql statement written page




first introduced depend on

 
the new configuration file. Here is the same general approach






sql statement output








a total of 11 data in the database

a lot of field data paged to return less than, and then extract it using Map

This is paged data package

flow chart


Code classes interceptors. You can try to package your own interceptor

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11469448.html