mybatis中if test 语句 当参数类型为string时,如何写判断条件

代码片段:
<select id="findPhonesById" parameterType="java.lang.String" resultType="java.lang.String">
select phone from contact_list cl left join contact_group cg on cl.d_id = cg.id
where 1 = 1
<if test="_parameter == 1">
and cl.d_id in (select distinct d_id from contact_list)
</if>
<if test="_parameter != 1">
and cl.d_id = #{id}
</if>
</select>

使用_parameter代替传入的参数,不会报错。 
原文地址:https://www.cnblogs.com/MIXP/p/7655591.html