您的位置:首页 > 其它

关于mybatis 传入基本参数类型使用if test 判断出错的问题

2017-04-07 16:42 761 查看

在使用mybatis传入基本参数类型时,比如parameterType="java.lang.Long",使用if test 判断会报错,所以需要使用_parameter 当做入参

正确代码:

<select id="findById" parameterType="java.lang.Long" resultMap="BaseResultMap">

        select

        *

        from

       reason op

        where

        1=1

        <if test="_parameter != null">

        and

        id = #{_parameter, jdbcType=BIGINT}

        </if>

    </select>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mybatis