数据库中字段 isDisable 0:否;1:是

xml中判断

<if test="isDisable != null and isDisable !='' ">
AND pu.is_disable = #{isDisable}
</if>

后台传入的是Integer 封装类。

修改:

<if test="isDisable != null ">
AND pu.is_disable = #{isDisable} 
</if>

去掉isDisable !='' 的判断。

Integer确实不需要判断 是否是空字符串。具体源码,还没有看。mark一下。

mybatis sql中if判断传入Integer类型,传入0时,判断没有执行的更多相关文章

  1. java5核心基础之泛型(3)-泛型作用于编译阶段-怎样将String对象传入Integer类型的泛型对象中?

    泛型作用于编译阶段: 泛型是作用于编译阶段,在编译阶段控制类型,以确保在编写代码的时候仅仅能传入指定类型数据到泛型集合对象中去. 怎样验证呢,贴代码例如以下: package highBasic.ge ...

  2. [c++][语言语法]函数模板和模板函数 及参数类型的运行时判断

    参考:http://blog.csdn.net/beyondhaven/article/details/4204345 参考:http://blog.csdn.net/joeblackzqq/arti ...

  3. mybatis中使用Integer类型的参数<if>判断问题

    mybatis对传入参数进行判断时,会使用if标签, 一般是判断不为null和'', 如下: <if test="name != null and 那么 != ''"> ...

  4. MyBatis参数条件查询传入的值为0时的判断

    MyBatis条件查询对字段判断是否为空一般为: <if test="testValue!=null and testValue != ''"> and test_va ...

  5. SQL 中的日期和时间类型

    在我们SQL中一般支持三种数据类型. date:日历日期,包括年(四位),月和日. time: 一天中的时间,包括小时,分和秒.可以用变量time(p)来表示秒的小数点后的数字位数(默认是0). 通过 ...

  6. mybatis将传入的Integer类型的0被识别成空字符串的问题

    更改mapper文件的sql如下: <if test="interger != null"> interger= #{interger} </if> 原因: ...

  7. mybatis sql中的条件语句

    1.mybatis判断是否为空或null <if test="type!=null and type!=''"> AND type = #{type} </if& ...

  8. Mybatis中 Integer 值为0时,默认为空字符串的解决办法。

    需求是查询级别为0的用户 User对象里的level字段的值为0,查询时居然没有查到为level为0的用户. <select id="selectSelective" par ...

  9. MyBatis参数为Integer型并赋值为0时判断失误的问题解决

    mybatis.xml中有if判断条件判断参数不为空时,赋值为0的Integer参数被MyBatis判断为空,因此不执行<if test="param != null and para ...

随机推荐

  1. [转]PHP经验——PHPDoc PHP注释的标准文档

    文档翻译自:http://en.wikipedia.org/wiki/Phpdoc 标记 用途 描述 @abstract   抽象类的变量和方法 @access public, private or ...

  2. 关于MyEclipse6.5 总是弹出 Update Progress(xx-xx-xx时间)的问题

    退出myeclispe 删除D:\Program Files\MyEclipse 6.0\eclipse\configuration\org.eclipse.update目录下的 last.confi ...

  3. audio,video标签

    <html><head lang="en"> <meta charset="UTF-8"> <title>< ...

  4. ant调用shell命令(Ubuntu)

    ant中调用Makefile,使用shell中的make命令 <?xml version="1.0" encoding="utf-8" ?> < ...

  5. PAT (Advanced Level) 1050. String Subtraction (20)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

  6. PowerDesigner设置线风格(直线,折线。。。)

    PowerDesigner中的绘图功能真是不敢恭维. 1.修改显示设置 Tools-->Display Preferences 这里有很多表现设置,我们需要的在Format菜单下. 点Modif ...

  7. 基于js脚本的单机黄金点游戏

    题目描述 N个同学(N通常大于10),每人写一个0-100之间的有理数 (不包括0或100),交给裁判,裁判算出所有数字的平均值,然后乘以0.618(所谓黄金分割常数),得到G值.提交的数字最靠近G( ...

  8. Quartz总结(三):动态修改定时器一

    package com.mc.bsframe.job; import org.quartz.Scheduler; import org.quartz.SchedulerException; impor ...

  9. base库插件---form

    $().extend('serialize', function () { for (var i = 0; i < this.elements.length; i ++) { var form ...

  10. Python+Selenium 环境配置之Firefox,IE,Chrome几种浏览器运行

    Selenium(Webdriver)支持Firefox,IE,Chrome等多个浏览器.很多人可能装环境时遇到很多问题,下面简单聊聊如何配置测试这几个浏览器以及相关通过简单的实例来测试. 1.Fir ...