MyBatis 传一个类型为String的参数时常见问题及解决方法

MyBatis要求如果参数为String的话,不管接口方法的形参是什么,在Mapper.xml中引用时需要改变为_parameter才能识别 :

<select id="selectByIp" parameterType="string" resultType="voteIP">
  select *
  form vote
  <where>
    <if test ="_parameter!= null">
      ip=#{_parameter}
    </if>
  </where>
</select>
posted @ 2018-02-02 19:25  三豪  阅读(629)  评论(0编辑  收藏  举报