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>