在传入参数的map中判断某个参数是否为某个字符串
这里的字符串比较
<if test='Where_Pattern == "NONE"'>
<foreach collection="key_value" index="index" item="item" separator=" or " open=" where (" close=") " >
${index} #{item}
</foreach>
</if>
Where_Pattern是map中的key,判断它的值用以上的方式就可以。
使用的原文如下:
-----------------------------
<select id="getEntityForList_QueryHelp" parameterType="map" resultMap="UserMap">
select <include refid="sql"/> from ${tableName}
<if test='Where_Pattern == "AND"'>
<foreach collection="key_value" index="index" item="item" separator=" and " open=" where (" close=") " >
${index} #{item}
</foreach>
</if>
<if test='Where_Pattern == "OR"'>
<foreach collection="key_value" index="index" item="item" separator=" or " open=" where (" close=") " >
${index} #{item}
</foreach>
</if>
<if test='Where_Pattern == "NONE"'>
<foreach collection="key_value" index="index" item="item" separator=" or " open=" where (" close=") " >
${index} #{item}
</foreach>
</if>
<if test="_parameter.containsKey('like')">
${like}
</if>
<if test="_parameter.containsKey('group_by')">
${group_by}
</if>
<if test="_parameter.containsKey('order_by')">
${order_by}
</if>
<if test="_parameter.containsKey('limit')">
limit ${pageNum},${pageSize}
</if>
</select>