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

    错误配置:

      mybatis的xml

     1    <select id="getDoctorList" resultMap="BaseResultMap" parameterType="java.lang.String">
     2     select 
     3     <include refid="Base_Column_List" />
     4     from doctor
     5     where 1=1
     6     <if test="name != null" >
     7     and name = #{name}
     8     </if>
     9     order by id
    10   </select>

      dao

    1 List<Doctor> getDoctorList(String name);

    修改方法一(推荐)

      xml不改,dao加上param注解

    1 List<Doctor> getDoctorList(@Param(value="name")String name);

    修改方法二

      dao不改,xml的参数用“_parameter”来代替

     1    <select id="getDoctorList" resultMap="BaseResultMap" parameterType="java.lang.String">
     2     select 
     3     <include refid="Base_Column_List" />
     4     from doctor
     5     where 1=1
     6     <if test="_parameter != null" >
     7     and name = #{_parameter}
     8     </if>
     9     order by id
    10   </select>
  • 相关阅读:
    K好数
    蓝桥杯 安慰奶牛
    蓝桥杯 节点选择
    模拟链表
    10588
    八数码的 八种境界
    HIT 2051
    概率DP
    数组越界溢出
    FATFS在SD卡里,写入多行数据出的问题
  • 原文地址:https://www.cnblogs.com/zhanghj405/p/5570304.html
Copyright © 2011-2022 走看看