- 异常信息:
-
- org.apache.ibatis.reflection.ReflectionException:There is no getter for property named 'parentId' in 'class java.lang.Long'
- 动态sql:
<selectid="selectByParentId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="column" />
from tb_item_cat
<where>
<if test="parentId != null">
parent_id=#{parentId}
</if>
</where>
</select>
- 原因:
-
- 原因出在test="parentId != null"
- 修改方法:
-
- 将参数parentId修改为_paramter
<select id="selectByParentId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="column" />
from tb_item_cat
<where>
<if test="_parameter != null">
parent_id=#{_parameter}
</if>
</where>
</select>