您的位置:首页 > 编程语言 > Java开发

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

2012-09-18 12:05 686 查看
用mybatis查询时,传入一个字符串传参数,且进行判断时,会报

Java代码


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

错误写法:

Java代码


<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)<=0)</when>
</choose>
</where>
lt;/select>

需要修改成:

Java代码


<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)<=0)</when>
</choose>
</where>
lt;/select>

不管你的参数是什么,都要改成"_parameter"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐