Mybatis3.1.1 if 或者 when判断条件不通过的问题
来源:互联网 发布:网络英语统考 编辑:程序博客网 时间:2024/05/16 01:43
调查了很久,终于找到了问题之所在。
Mybatis3.1.1中 if 或者 when如果按照下面的写法是不会通过的。
错误写法:
<when test="reqType != null and reqType == '0'">
<if test="reqType != null and reqType == '0'">
因为里面的单引号包裹的字符串(例子中是'0')解析时候被去掉单引号认为是数值。
正确写法:
<when test="reqType != null and reqType == '0'.toString()">
<if test="reqType != null and reqType == '0'.toString()">
或者
<when test='reqType != null and reqType == "0"'>
<if test='reqType != null and reqType == "0"'>
多么痛的领悟!
Mybatis3.1.1中 if 或者 when如果按照下面的写法是不会通过的。
错误写法:
<when test="reqType != null and reqType == '0'">
<if test="reqType != null and reqType == '0'">
因为里面的单引号包裹的字符串(例子中是'0')解析时候被去掉单引号认为是数值。
正确写法:
<when test="reqType != null and reqType == '0'.toString()">
<if test="reqType != null and reqType == '0'.toString()">
或者
<when test='reqType != null and reqType == "0"'>
<if test='reqType != null and reqType == "0"'>
多么痛的领悟!
4 0
- Mybatis3.1.1 if 或者 when判断条件不通过的问题
- Mybatis3.1.1中 if 或者 when如果按照下面的写法是不会通过的。
- if()中的判断条件为什么被判断不通过
- Erlang笔记(05) - Erlang条件判断: if, case, when
- Mybaitis if 标签的条件判断遇到的问题
- MyBatis3 if判断单个字符的字符串时报错
- IF条件判断,判断条件
- 一个if 判断条件的常见错误
- if条件判断上的bug
- js中if的条件判断
- jst中,if的判断条件
- 【shell】脚本中if条件的判断
- 赋值语句作为if的判断条件
- mybatis的<if test> 条件判断
- mybatis的<if test> 条件判断
- cmd if条件 条件判断
- 条件判断:if
- javascript if条件判断
- 一些实用的编程贴士
- 《学习OpenCV》第三章课后题4
- ORA-01009: missing mandatory parameter
- 使用redis加速ansible
- 英语句子分词
- Mybatis3.1.1 if 或者 when判断条件不通过的问题
- Android中利用反射机制来控制AlertDialog窗口不被关闭
- TI81XX UBOOT
- delphi xe8 多线程和hash函数 base64 用法
- sharedPreference的用法
- 我的Java开发学习之旅------>求N内所有的素数
- Linux用户、用户组、文件权限【命令实战】
- 深入解析String intern
- 检测手机信号质量