mybatis 之 if test 条件,参数为0时,查询条件未输出
2017-07-17 12:07
447 查看
解决方法:
将
<if test=" null != tagtype and ‘’!= tagtype">
AND tagtype = #{tagtype}
</if>
修改为
<if test=" null != tagtype and ''
0 != tagtype">
AND tagtype = #{tagtype}
</if>
原因就是 忽略了参数为 0 就代表参数类型时int 默认值应该是 0
将
<if test=" null != tagtype and ‘’!= tagtype">
AND tagtype = #{tagtype}
</if>
修改为
<if test=" null != tagtype and ''
0 != tagtype">
AND tagtype = #{tagtype}
</if>
原因就是 忽略了参数为 0 就代表参数类型时int 默认值应该是 0
相关文章推荐
- mybatis模糊查询及if多条件(if条件的参数为方法参数而非数据库字段)
- Mybatis 不确定条件查询(动态语句where和if)借助实体类封装参数
- myBatis查询某个时间区间数据<if test=""> 如何写判断条件,and 里面的内容怎么写?
- 使用mybatis遇到的关于条件查询">"以及if test传参的使用问题
- Mybatis if条件 模糊查询非利用example扩展类
- mybatis if判断int类型的查询条件如何判断空和空字符串
- MyBatis中的动态SQL,实现不确定条件的CRUD-----使用Map来传递查询的参数
- Mybatis中通过HaseMap封装参数作为查询条件
- Mybatis中查询的参数为Map条件中是in 数据组参数
- Mybatis动态sql条件查询中if判断Integer的条件写法
- Mybatis中查询的参数为Map条件中是in 数据组参数
- mybatis 参数为String,if test读取该参数
- mybatis的参数 <if test="_parameter != null" > </if>
- Mybatis 动态加载sql when otherwise choose 理解成if else 条件中可以把传来的参数当变量
- mybatis 之 if test 条件
- mybatis 之 if test 条件
- mybatis if test 之 0当做参数传入出问题
- mybatis 之 if test 条件
- mybatis if test加筛选条件
- mybatis if test 之 0当做参数传入出问题