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总页数
在这里插入图片描述


版权声明:本文为m0_51527921原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/m0_51527921/article/details/123331675