mybatis 里面使用<if test=""> 判断,当后台传的值是数字字符串时,怎么处理

来源:互联网 发布:js调用windows命令 编辑:程序博客网 时间:2024/05/16 18:42
<select id="getByNameAndPwd" parameterType="String" resultMap="MemberResult">
        select
           *
        from `member`
        <if test="isMerch != '' and isMerch == '1'.toString() " >
            where  `mobile` = #{name}
            and `password` = #{password}
        </if>
        <if test="isMerch != '' and isMerch == '2'.toString() " >
            where  `name` = #{name}
            and `password` = #{password}

        </if>  

</select>

如上所示:要在数字字符串后面加.toString()方法,否则将无法识别。

原创粉丝点击