宇筱博客

  • 解决办法
  • 学无止境
  • 记录时光
  • 百宝箱
宇筱博客
点滴记忆,汇聚成海。
  1. 首页
  2. 解决办法
  3. 正文

当传入数据只有一个时mybatis中判断会出现There is no getter for property named 'subjectId' in 'class java.lang.Intege

2017年1月9日 862点热度 0人点赞 0条评论

转载于:http://www.cnblogs.com/y-z-q/p/5734029.html

用"_parameter"代替当前参数

正确:

<select id="selectSubjectByPId"  parameterType="java.lang.Integer" resultType="java.util.Map">
        select subjectId,subjectName 
        from ts_subject 
        where subjectParentId= 0 
        <if test="_parameter != null">
            and subjectId = #{_parameter,jdbcType=INTEGER}
        </if>
</select>

错误:

<select id="selectSubjectByPId"  parameterType="java.lang.Integer" resultType="java.util.Map">
        select subjectId,subjectName 
        from ts_subject 
        where subjectParentId= 0 
        <if test="subjectId != null">
            and subjectId = #{subjectId,jdbcType=INTEGER}
        </if>
</select>

这时候就会出现异常.

There is no getter for property named 'subjectId' in 'class java.lang.Intege

标签: 暂无
最后更新:2017年1月9日

小渔民

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2025 宇筱博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备15017825号-2