转载自://http://www.cnblogs.com/anee/p/3324140.html

用mybatis查询时,传入一个字符串传参数,且进行判断时,会报

  1. There is no getter for property named 'moduleCode' in 'class java.lang.String

错误写法:

  1. <select id="queryAllParentModule" resultType="jobModule" parameterType="jobModule">
  2. select modulecode,
  3. modulename,
  4. modulevalue,
  5. linkurl,
  6. rank,
  7. parentmodule=isnull(parentmodule,1),
  8. moduledescription
  9. from job_module
  10. <where>
  11. <choose>
  12. <when test="moduleCode!=null and moduleCode!=''">modulecode = #{moduleCode}</when>
  13. <when test="moduleCode==null or moduleCode==''">(parentmodule is null or len(parentmodule)&lt;=0)</when>
  14. </choose>
  15. </where>
  16. lt;/select>

需要修改成:

  1. <select id="queryModuleByCode" resultType="jobModule" parameterType="string">
  2. select modulecode,
  3. modulename,
  4. modulevalue,
  5. linkurl,
  6. rank,
  7. parentmodule=isnull(parentmodule,1),
  8. moduledescription
  9. from job_module
  10. <where>
  11. <choose>
  12. <when test="_parameter!=null and _parameter!=''">modulecode = #{_parameter}</when>
  13. <when test="_parameter==null or _parameter==''">(parentmodule is null or len(parentmodule)&lt;=0)</when>
  14. </choose>
  15. </where>
  16. lt;/select>

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

REFERENCES:http://txin0814.iteye.com/blog/1533645


---------------------------------------------------------------------------------------------------------------------------------
copyright:http://www.cnblogs.com/anee/

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

  1. Mybatis问题:There is no getter for property named 'unitId' in 'class java.lang.String'

    Mybatis遇到的问题 问题: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.re ...

  2. mybatis之org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'time' in 'class java.lang.String'

    mybatis接口 List<String> getUsedCate(String time); 配置文件 <select id="getUsedCate" pa ...

  3. mybatis问题: There is no getter for property named 'equipmentId' in 'class java.lang.String'

    本文来源于翁舒航的博客,点击即可跳转原文观看!!!(被转载或者拷贝走的内容可能缺失图片.视频等原文的内容) 若网站将链接屏蔽,可直接拷贝原文链接到地址栏跳转观看,原文链接:https://www.cn ...

  4. Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String'

    错误异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr ...

  5. Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'

    Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String' 一.发现问题 <select ...

  6. 【Mybatis】mybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'

    mybatis查询报错: Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for pro ...

  7. 已解决: mybatis报错 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in 'class java.lang.String'

    最近在练习MyBatis时 进行姓名的模糊查询时候出现 org.apache.ibatis.exceptions.PersistenceException: ### Error querying da ...

  8. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'socialCode' in 'class java.lang.String'

    异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Refl ...

  9. Mybatis异常There is no getter for property named 'XXX' in 'class java.lang.String'

    1.当入参为 string类型时 (包括java.lang.String.)  我们使用#{xxx}引入参数.会抛异常There is no getter for property named 'XX ...

随机推荐

  1. 【CF刷题】14-05-12

    Round 236 div.1 A:只需要每个点连接所有比他大的点,知道边用完为止. //By BLADEVIL #include <cmath> #include <cstdio& ...

  2. hihocoder #1058 Combination Lock

    传送门 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a ...

  3. 求DAG上两点的最短距离

    Problem 给出一个不带边权(即边权为1)的有向无环图(unweighted DAG)以及DAG上两点s, t,求s到t的最短距离,如果无法从s走到t,则输出-1. Solution DFS,BF ...

  4. iOS 开发之内购 – AppStore

    前言本文会给大家详细介绍iOS内购,虽然之前网上也有内购的教程,但是还不够详细,我重新整理出一份教程,希望对大家有所帮助.    基于Xcode7.1.1版本,模拟器iphone6,9.1系统.    ...

  5. 求任意长度数组的最大值(整数类型)。利用params参数实现任意长度的改变。

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  6. html input file标签的上传文件 注意点

    文件上传框  代码格式:<input type=“file” name=“...” size=“15” input enctype="multipart/form-data“ maxl ...

  7. Unity自动打包Apk

    unity打包apk相对来说比较容易,相信出过的人都明白,出包过程,没有大的难度,一步一操作,一步一等待,繁琐耗时,不懂的人又代替不了.这时候需求就来了,如何简单的一键打包搞定,这个就稍微有点难度,当 ...

  8. epoch iteration batchsize

    深度学习中经常看到epoch. iteration和batchsize,下面按自己的理解说说这三个的区别: (1)batchsize:批大小.在深度学习中,一般采用SGD训练,即每次训练在训练集中取b ...

  9. 图片服务器和WEB应用服务器相分离的简单方案

    只是简单说明一下原理,其它的自己探索吧:) 一.两个域名:www.domain.com和img.domain.com 二.在www域名的服务器中上传文件: up.html <form name= ...

  10. H2Database数据类型

    数据类型   整数(INT) 布尔型(BOOLEAN) 微整数(TINYINT) 小整数(SMALLINT) 大整数(BIGINT) 标识符(IDENTITY) 货币数(DECIMAL) 双精度实数( ...