当前位置: 代码迷 >> Java Web开发 >> 有关mybatis传入参数的有关问题!贼急 贼急
  详细解决方案

有关mybatis传入参数的有关问题!贼急 贼急

热度:6672   发布时间:2013-02-25 21:16:38.0
有关mybatis传入参数的问题!贼急! 贼急!
AMapper.java中定义

public int method(String str); ---------------1

AMapper.xml中定义

<select id="method" parameterType="java.lang.String">

  select count(*) from table 
  <if test = "str != null"> ----------------2
  where colume = #{str}
  </if>
</select>

以上形式 在执行的时候会报异常 提示 str no getter………………

但是 如果 在 1 处 改为 method(@Param str) 即可正常
或 去掉2 处的判断也可正常

求教 其中的原理!!!!!!!!!

大侠帮忙啊!!!!

------解决方案--------------------------------------------------------
<if test = "#{str != null}"> ----------------2
where colume = #{str}
</if>
  相关解决方案