码迷,mamicode.com
首页 > 编程语言 > 详细

MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer

时间:2015-07-05 22:25:02      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:

用MyBatis进行查询,传入参数只有一个时(非Map)如int,报错

There is no getter for property named ‘sleevetype‘ in ‘class java.lang.Integer

原因在于测试条件写法有误,

        <if test="sleevetype==0"><!-- 专属 -->
            exclusive=1
        </if>
        <if test="sleevetype!=0"><!-- 非专属 -->
            sleeve_type=#{sleevetype} and exclusive=0
        </if>

正确写法:

        <if test="_parameter==0"><!-- 专属 -->
            exclusive=1
        </if>
        <if test="_parameter!=0"><!-- 非专属 -->
            sleeve_type=#{sleevetype} and exclusive=0
        </if>

 不管传的参数是什么,都要改成"_parameter" 。

 

MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer

标签:

原文地址:http://www.cnblogs.com/z-sm/p/4623026.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!