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 = #{_parameter,jdbcType=VARCHAR}
</if>
<if test="_parameter==null or _parameter==''">
AND DEPART_PID IS NULL
</if>
</where>
</select>