mybatis-plus 分页操作
通过 username,email,address 等参数查询分页
// 分页查询 - mybatis-plus的方式
@GetMapping("/page")
public IPage<User> findPage(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam(defaultValue = "") String username,
@RequestParam(defaultValue = "") String email,
@RequestParam(defaultValue = "") String address) {
IPage<User> page = new Page<>(pageNum, pageSize);
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
if (!"".equals(username)) {
queryWrapper.like("username", username);
}
if (!"".equals(email)) {
queryWrapper.like("email", email);
}
if (!"".equals(address)) {
queryWrapper.like("address", address);
}
queryWrapper.orderByDesc("id");
return userService.page(page, queryWrapper);
}
标签:username,queryWrapper,分页,RequestParam,plus,address,mybatis,email
From: https://www.cnblogs.com/Mr-Thorns/p/16768552.html