MyBatisの使用pagehelperプラグ

1. [追加]は、プラグインに依存しています

<依存性> 
   <のgroupId> com.github.pagehelper </のgroupId> 
   <たartifactId> pagehelper </たartifactId> 
   <バージョン> 5.04 </バージョン> 
</依存> 
<依存性> 
   <のgroupId> com.github.pagehelper </のgroupId> 
   <たartifactId> pagehelper-スプリングブート自動設定</たartifactId> 
   <バージョン> 1.25 </バージョン> 
</依存> 
<依存性> 
   <のgroupId> com.github.pagehelper </のgroupId> 
   <たartifactId> pagehelperスプリングブートスタータ</たartifactId> 
   <バージョン> 1.2

プロファイルを追加2.

pagehelper.helper-方言= mysqlの
pagehelper。params =カウント= countSql 
pagehelper.reasonable = 
pagehelper.supportの -methods-引数= 

3.新しいテストクラスのテスト

@GetMapping(" /リスト" 
@ResponseBodyの
公共 PageInfo <ユーザ> getUserList(){
 // タブページと始まるのも数 
 PageHelper.startPage(05。);
 // コールクエリメソッド、ときクエリメソッド戻りデータは、ページングされた 
 一覧<ユーザー>リスト= userService.selectAll();
 // パッケージのページングパラメータは、フロントに戻っ 
PageInfo PageInfo = 新新PageInfo(一覧);
 リターンPageInfo; 
}


失敗は内部ポンポンAOP依存して裁判で添加することができる場合

<依存性> 
   <のgroupId> org.springframework.boot </のgroupId> 
   <たartifactId>ばねブートスタータAOP </たartifactId> 
</依存>

 

 

おすすめ

転載: www.cnblogs.com/red-star/p/12057112.html