MyBatis-Plus (opens new window)(简称 MP)是一个 MyBatis的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发、提高效率而生。
在Mybatis-Plus的 BaseMapper 中,已经内置了2个支持分页的方法:
<P extends IPage<T>> P selectPage(P page, @Param("ew") Wrapper<T> queryWrapper);
<P extends IPage<Map<String, Object>>> P selectMapsPage(P page, @Param("ew") Wrapper<T> queryWrapper);
复制代码
所以可以基于 BaseMapper 来实现基本的分页查询 当前来查询 用户分类数据
1 基于 BaseMapper 来实现分页查询
/**
* <p>
* 用户分类表 前端控制器
* </p>
*
* @author 早起的年轻人
* @since 2023-03-14
*/
@Api(tags="用户分类模块")
@RestController()
@RequestMapping("/auto/userCategory")
public class UserCategoryController {
@Resource
IUserCategoryService userCategorySer