1.分页带条件查询
/**
* 分页带条件查询老师信息
* @param pageNo
* @param o
* @return
*/
public PageInfo teacherPage(int pageNo, Teacher o) {
PageHelper.startPage(pageNo, Sys.pageSize,"id desc");
LambdaQueryWrapper<Teacher> lambdaQueryWrapper = Wrappers.lambdaQuery();
//条件查询
if (Objects.nonNull(o.getRealName()) && o.getRealName().trim().length()>0) {
lambdaQueryWrapper.like(Teacher ::getRealName, o.getRealName());
}
if (Objects.nonNull(o.getState())) {
lambdaQueryWrapper.eq(Teacher ::getState, o.getState());
}
if (Objects.nonNull(o.getTeaNo()) && o.getTeaNo().trim().length()>0) {
lambdaQueryWrapper.eq(Teacher ::getTeaNo, o.getTeaNo());
}
List<Teacher> li = teacherDao.selectList(lambdaQueryWrapper);
PageInfo<Teacher> pageInfo=new PageInfo(li,Sys.pageSize);
return pageInfo;
}
2.不分页排序
lambdaQueryWrapper.orderByDesc(StoreConsumer::getRegisterTime);
3.springboot整合mybatisPlus