zoukankan      html  css  js  c++  java
  • mybatis There is no getter for property named 'xx' in 'class java.lang.String

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

    Java代码  收藏代码
    1. There is no getter for property named 'moduleCode' in 'class java.lang.String  



    错误写法: 

    Java代码  收藏代码
    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>  



      需要修改成: 

     

    Java代码  收藏代码
    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

  • 相关阅读:
    Sliding Window
    方程的解数
    [JLOI2011]不重复数字
    A−B数对
    2007年分区联赛提高组之一 统计数字
    Magic Squares 魔板 (BFS+HASH)
    集合(normal)
    Place the Robots
    LoadRunner监控Linux
    CentOS6.3(64位)下安装Oracle11gR2(64)服务器
  • 原文地址:https://www.cnblogs.com/anee/p/3324140.html
Copyright © 2011-2022 走看看