mp的分页查询,我寻思着这不是很简单,但是一调用属性接口Employee::getName
就报错,这是为何。前面有一个登录查询还能正常用。
mp版本3.5.1
/**
* 分页查询
* @param page
* @param pageSize
* @param name
* @return
*/
@GetMapping("/page")
public R getPage(@RequestParam Integer page,
@RequestParam Integer pageSize,
@RequestParam(defaultValue = "") String name) {
QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
queryWrapper.like(Strings.isNotEmpty(name), Employee::getName, name);
queryWrapper.orderByDesc(Employee::getUpdateTime);
return R.success(employeeService.page(new Page<>(page, pageSize), queryWrapper));
}