mybatis中使用if标签比较两个字符串是否相等
<!-- 此处使用if比较是否相等 -->
<select id="findClientIds" parameterType="map" resultType="map">
SELECT sys_user.id,sys_user.clientId FROM sys_user
<where>
<if test="grade!= null and grade!= ''and grade == '3'.toString()">
id =(
SELECT PRIMARY_PERSON FROM sys_office WHERE id =
(SELECT office_id FROM sys_user WHERE id = #{userId}
))
</if>
<if test="grade!= null and grade!= '' and grade == '2'.toString()">
id =(
SELECT PRIMARY_PERSON FROM sys_office WHERE id =
(SELECT company_id FROM sys_user WHERE id = #{userId}
))
</if>
<if test="grade!= null and grade!= '' and grade == '1'.toString()">
id = ''
</if>
</where>
</select>