如何在 XML <if test> 忽略大小写的情况下比较 MyBatis 3 中的字符串

How to compare Strings in MyBatis 3 in XML <if test> ignoring the case

this post所述

<if test="sortBy == 'col1' ">
     ...
</if>

只按大小写比较字符串。 MyBatis XML Mapper 有类似equalsIgnoreCase 的方法吗?

不优雅的人可以

<if test="sortBy == 'col1' or sortBy == 'COL1' ">
   ...
</if>

Java 代码将起作用,只需将 test 属性双引号更改为单引号,或转义它们:

<if test='"col1".equalsIgnoreCase(sortBy)'> 
 ...
</if>