报错:
Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression ‘ew.sqlSegment != null and ew.sqlSegment != ‘’ and ew.nonEmptyOfWhere’. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: not support this column !]
错误代码:
NewsPO whereParams = new NewsPO();
whereParams.setTitle(title);
whereParams.setContentUrl(contentUrl);
whereParams.setEnableFlag(enableFlag);
whereParams.setShopId( selectedCurrentShopId);
QueryWrapper<NewsPO> queryWrapper = Wrappers.query()
.setEntity(whereParams)
.orderBy(StringUtils.isBlank(sortBy), "asc".equalsIgnoreCase(direction), sortBy);
Page pageParams = new Page().setCurrent(page).setSize(limit);
错误原因:
orderBy(StringUtils.isBlank(sortBy), "asc".equalsIgnoreCase(direction), sortBy)
StringUtils.isNotBlank 写成 StringUtils.isBlank,导致传入的sortBy实际为null