mybatis と mybatis-plus を同時に使用すると、pageHelper の失敗の問題が解決されます

クラスを追加します。このクラスは PageInterceptor クラスの初期化に使用されます。今回は試行が成功し、ページ化されたデータが正しく返されます。コードは以下のように表示されます。

インポート com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
インポート com.github.pagehelper.PageInterceptor;
インポート org.springframework.context.annotation.Bean;
インポート org.springframework.context.annotation.Configuration;

インポート java.util .Properties; 

@Configuration 
public class MyBatisPlusConfig { 

    /* 
     * ページネーションプラグイン、データベースタイプを自動識別
     * マルチテナント、公式サイトを参照【プラグイン拡張機能】
     */ 
    @Bean 
    public PaginationInnerInterceptor paginationInterceptor() { 
        return new PaginationInnerInterceptor(); 
    } 

    @Bean 
    PageInterceptor pageInterceptor() { 
        PageInterceptor pageInterceptor = new PageInterceptor();
        プロパティproperties = new Properties();
        property.setProperty("helperDialect", "mysql"); 
        pageInterceptor.setProperties(properties); // ここにソース コードを入力でき、
        return pageInterceptor; 
    } 
}

おすすめ

転載: blog.csdn.net/zhongguowangzhan/article/details/127007644