mybatis There is no getter for property named 'xx' in '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,
       modulename,
       modulevalue,
       linkurl,
       rank,
       parentmodule=isnull(parentmodule,1),
       moduledescription
from job_module
<where>
          <choose>
              <when test="moduleCode!=null and moduleCode!=‘‘">modulecode = #{moduleCode}</when>
              <when test="moduleCode==null or moduleCode==‘‘">(parentmodule is null or len(parentmodule)&lt;=0)</when>
          </choose>
      </where>
lt;/select>  

需要修改成:

<select id="queryModuleByCode" resultType="jobModule" parameterType="string">
select modulecode,
       modulename,
       modulevalue,
       linkurl,
       rank,
       parentmodule=isnull(parentmodule,1),
       moduledescription
from job_module
<where>
          <choose>
              <when test="_parameter!=null and _parameter!=‘‘">modulecode = #{_parameter}</when>
              <when test="_parameter==null or _parameter==‘‘">(parentmodule is null or len(parentmodule)&lt;=0)</when>
          </choose>
      </where>
lt;/select>  

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

mybatis There is no getter for property named 'xx' in 'class java.lang.String

时间: 2024-08-28 13:25:24

mybatis There is no getter for property named 'xx' in 'class java.lang.String的相关文章

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;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之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;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_

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

[ERROR] 2017-01-18 04:37:06:231 cn.dataenergy.common.CenterHandlerExceptionResolver (CenterHandlerExceptionResolver.java:44) - 统一捕获异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Th

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

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'parentId' in 'class java.lang.String' at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:333) at org.apache.ibatis.reflection.Meta

MyBatis3: There is no getter for property named &#39;code&#39; in &#39;class java.lang.String&#39;

mybatis3  : mysql文如下,传入参数为string类型时‘preCode’,运行报错为:There is no getter for property named 'preCode' in 'class java.lang.String 执行sql: mapper.xml文件: <select id="getMaxCode" parameterType="string" resultType="string"> sele

mybaits错误解决:There is no getter for property named &#39;id&#39; in class &#39;java.lang.String&#39;(转)

在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter来代替参数名. 正确的写法: [html] view plain <span style="font-size:18px;">    <!-- 用于查询运单号是否存在 --> <select id="isCargoBillNoExist" resultType="java.lang.Integer&quo