Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在mybatis中做if语句,<if test="param.equals('Y')">即使参数为“Y”也返回false,但 <if test="param.equals('Yes')">参数为“yes”时返回true,这是为什么呢?
<if test="param.equals('Y')">
<if test="param.equals('Yes')">
看来您正在尝试将字符串与 char 进行比较,请您改为这样做
<if test='param.equals("Y")'>
或者你可以在 mybatis 中使用 == 所以在这种情况下语句是
<if test="param == 'Y'">