MyBatis 动态SQL String 参数为空

来源:互联网 发布:淘宝舒口健竹盐牙膏 编辑:程序博客网 时间:2024/05/22 03:39

mybatis 参数为String,if test读取该参数代码:

<select id="getMaxDepartId" parameterType="java.lang.String" resultType="java.lang.String">
        SELECT MAX(DEPART_ID) FROM T_P_DEPART 
        <where>
            <if test="_parameter!=null and _parameter!=''">  
                AND DEPART_PID = #{departId,jdbcType=VARCHAR} 
            </if>
            <if test="_parameter==null or _parameter==''">  
                AND DEPART_PID IS NULL
            </if>
        </where>
    </select>

0 0