Mybatis报错 There is no getter for property named xx in xxx

编写接口的时候遇到一个错误

Request processing failed; nested exception is
org.mybatis.spring.MyBatisSystemException: nested exception is
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named ‘record’ in ‘class java.math.BigDecimal’

具体的mybatis配置文件如下:

<select id="countScore" resultType="int">
    select count(1) as num from tb_score
    <if test="record != null">
        where score <= #{record,jdbcType=DECIMAL}
    </if>
</select>

mapper的接口方法如下:

int countScore(BigDecimal record);

看了很久一直没有找到原因,最后在网上查到是<if test="record != null">的问题,这里我只传了一个参数就是record,但是它提示找不到,解决方案是将这句话改为<if test="_parameter != null">

Search by:GoogleBingBaidu