mybatisPlus查询报错
问题:
Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew != null and ew.sqlFirst != null'. Cause: org.apache.ibatis.ognl.OgnlException: sqlFirst [com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not use this method for "getSqlFirst"]
报错代码
lambdaQuery().orderByDesc(Product::getVisitCount)
正确代码:
lambdaQuery().getWrapper().orderByDesc(Product::getVisitCount);
增加getWrapper(),就能正常运行