MybatisPlus配置类引入分页插件
@Configuration
@MapperScan("com.study.mybatisplus.mapper")
public class MybatisPlusConfig {
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
定义Mapper分页查询接口
List<ApplyInfoEntityDTO> findApplyInfo(Page<ApplyInfoEntityDTO> page, @Param("condition") QueryApplyInfoDTO queryApplyInfoDTO);
定义查询操作
<select id="findApplyInfo" resultType="com.study.mybatisplus.dto.response.ApplyInfoEntityDTO">
SELECT <include refid="Base_Column_List"></include>
FROM apply_info WHERE deleted = 0
ORDER BY
updated_date DESC, created_date DESC
</select>
使用swagger测试,即可获得total总数,size每页大小,current当前页数,pages总页数