mybatis if else 判断 传入整数为0时 不能过滤的解决方案

场景如下:

1.数据库中guideType 为Integer类型;

2.实体bean中:

private Long guideType;

(
setter...
getter...
)

3.mybatis相应的xml配置中判断该字段时,针对传入0 特殊处理如下:

<if test="(guideType != null and guideType != '') or guideType==0">
    guide_type= #{guideType},
</if>

猜你喜欢

转载自blog.csdn.net/fantasy522272820/article/details/77581639