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

  • 相关阅读:
    关于IQKeyboardManager的使用
    iOS 关于退出键盘两种方法和避免遮挡
    iOS获取各种数据方法整理以及IDFA与IDFV使用环境
    npm安装模块 -g和--save和--save-dev的区别
    最详细的原生js实现ajax的封装
    js中Math对象常用的属性和方法
    js中的兼容问题汇总
    js中数组方法及分类
    浅析js中的this
    js中的兼容
  • 原文地址:https://www.cnblogs.com/anee/p/3324140.html
Copyright © 2011-2022 走看看