<!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
<scope>runtime</scope>
</dependency>
public interface ByReconcileDepartMapper extends BaseMapper<ByReconcileDepart>{}
public interface IByReconcileDepartService extends IService<ByReconcileDepart> {}
public class ByReconcileDepartServiceImpl extends ServiceImpl<ByReconcileDepartMapper, ByReconcileDepart> implements IByReconcileDepartService {}
@Test
public void listPage() {
QueryWrapper<ByReconcileDepart> q = new QueryWrapper<ByReconcileDepart>();
q.eq("scenes_name", "大型自助机");
// 可以整合pagehandler, pom文件注意剔除, getTotal 获取总条数, 注意配置文件的配置方式
Page<ByReconcileDepart> startPage = PageHelper.startPage(5, 3);
List<ByReconcileDepart> list = service.list(q);
long total = startPage.getTotal();
System.out.println(total);
System.out.println(list.size());
}
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.2.0</version>
</dependency>
<!-- 默认模板pom -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.1</version>
</dependency>
@Bean public OptimisticLockerInterceptor optimisticLockerInterceptor() { return new OptimisticLockerInterceptor(); }