MyBatis-plus报错:Error evaluating expression ‘ew.sqlSegment != null

报错信息

Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew.sqlSegment != null '. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: not support this column !]

问题重现

 QueryWrapper ew = new QueryWrapper();
 ew.likeRight(StringUtils.isNotEmpty(projectCardNumber),projectCardNumber);
 List<FinishedProductInStockVO> list = baseMapper.selectFinishedProductInStockVO(ew,
         searchParam, startInTime, endInTime);

报错原因

ew.likeRight(boolean condition,object cloumn,object value)
参数传递有误
少传一个参数!!

更正

ew.likeRight(StringUtils.isNotEmpty(projectCardNumber), "t2.project_card_number", projectCardNumber);

问题报错:ew.sqlSegment != null 很容易误解为ew的传参问题,但确实也是它的问题,可以通过debug查看ew的expression 中的normal 属性是否被赋值来查看条件是否生效

你可能感兴趣的:(工作随手记)