有个需求需要根据枚举来做判断。
网上的写法有
枚举的定义
HOUR("hour"),
DAY("day"),
MONTH("month"),
YEAR("year");
<if test="dtEnum == @com.xxx.xxx.TestTypeEnum@HOUR">
</if>
然后还有这种
<if test="isEnable != null">
<if test="isEnable.toString() == 'CLOSE'">
id is null
</if>
<if test="isEnable.toString() == 'OPEN'">
id is not null
</if>
</if>
注意,用我这种不能在枚举类上标注@Data或者@ToString,会导致识别问题。