<select id="findUserById" parameterType="int" resultType="User">
        select * from user1 
        <where>
            <if test="id != null and id != ''">
                and id=#{id}
            </if>
        </where>
    </select>

 在测试时报错:There is no getter for property named 'id' in 'class java.lang.Integer'

 问题分析:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取integer.id值,引起报错。

 解决方法:  public User findUserById(@Param("id")int id);说明参数值。

相关文章:

  • 2021-11-20
  • 2022-02-04
  • 2021-08-25
  • 2021-11-21
  • 2021-10-10
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-03
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-07-24
相关资源
相似解决方案