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

用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

时间: 2024-10-22 01:47:23

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

mybatis之org.apache.ibatis.reflection.ReflectionException: There is no getter for property named &#39;time&#39; in &#39;class java.lang.String&#39;

mybatis接口 List<String> getUsedCate(String time); 配置文件 <select id="getUsedCate" parameterType="java.lang.String" resultType="java.lang.String"> select distinct(cate.cate_name) from account as acc left join conCateg

Mybatis中传参包There is no getter for property named &#39;XXX&#39; in &#39;class java.lang.String&#39;

一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType="string"> select num,name,phone from student <where> <if test = " num!=null and num!='' "> AND num = #{num} </if> <

Mybatis中传参包There is no getter for property named &#39;roomName&#39; in &#39;class java.lang.String&#39;

一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType="string"> select num,name,phone from student  <where> <if test = " num!=null and num!='' ">AND num = #{num}</if></w

mybatis There is no getter for property named &#39;xx&#39; in &#39;class java.lang.String

用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 There is no getter for property named 'moduleCode' in 'class java.lang.String 错误写法: <select id="queryAllParentModule" resultType="jobModule" parameterType="jobModule"> select modulecode,

mybatis 异常 There is no getter for property named &#39;bizId&#39; in &#39;class java.lang.Long&#39;

mybatis 异常 There is no getter for property named 'bizId' in 'class java.lang.Long' 当使用mybatis进行传参的时候,参数只有一个时会出现这种类似的错误. 解决: 1.接口定义出,指定参数名 2.在xml 中指定类型 mybatis 异常 There is no getter for property named 'bizId' in 'class java.lang.Long'

(mybatis)There is no getter for property named &#39;isEffective&#39; in &#39;class java.lang.String

原来代码: <select id="findSpecialOffer" resultType="com.lizard.back.model.SpecialOffer" parameterType="java.lang.String"> SELECT taso.id, taso.product_id as productId , taso.table_name as tableName, taso.start_time_special_

Mybatis问题:There is no getter for property named &#39;unitId&#39; in &#39;class java.lang.String&#39;

Mybatis遇到的问题 问题: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'unitId' in 'class java.lang.String' at org.mybatis.spring.MyBatisExceptionTransla

Mybatis 报错 There is no getter for property named &#39;***&#39; in &#39;class java.lang.String&#39;

在mapper.xml中 , 如果单参数是String类型 , 且在sql语句中对参数进行了判断 , 如下 when 中的判断 , 如果出现 if 判断也是一样的.都需要把判断中的参数用 _parameter 来代替 ,. 另外orcal中判断字段是否为空需要使用 is null , 同理,判断不为空使用 is not null . 错误查询: <select id = "select" resultMap="ResultMap" parameterType=

Mybatis There is no getter for property named ‘X‘

在尝试使用mybatis的动态sql中遇到这么一个问题, 使用Mybatis查询时,其参数可以是基本数据类型或者像Integer和String这样的简单的数据对象,也可以是复杂对象(一般是指JavaBean)或者map等,当使用基本数据类型的参数时,若这个参数的使用放在了判断条件中, <!-- mybatis 动态sql--> <select id="findFruit" resultType="Fruit">     SELECT * FR