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

来源:互联网 发布:linux计划任务每分钟 编辑:程序博客网 时间:2024/06/06 17:43

场景如下:

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>
阅读全文
0 0
原创粉丝点击