关于SSM中分页时报错There is no getter for property named ‘XXX’ in ‘class java.lang.String和其他param报错’__frch_criterion_1’
-
一 。mybatis的自动生成 mapper.xml文件 时 分页的语句 和实际操作不一致
-
我们必须在 mapper接口文件中的 方法参数上加 @Param(value=“example”)
然后在 List selectByExample(@Param(“example”) TbContentExample example); -
二。 在 mapper.xml中 sql语句中加上
select// 并在 这里 加上example
distinct
from tb_content
// 并在 这里 加上example
order by ${orderByClause}
- 三。。两处exmaple 是因为· mybatis注入参数时 发生错误 在进行SQL语句时
无法判断 数据 的 空于非空 ,加上注解 @Param(“example”) 就可解决这个问题