mybatis中判断字符串
来源:互联网 发布:luaeditor mac 编辑:程序博客网 时间:2024/06/03 13:25
mapper.xml中判断字符串
<if test="flag == 'N'">
AND cust.certificate_no NOT IN (#{idCards})
</if>
这种写法会报:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.NumberFormatException: For input string: "N"
### Cause: java.lang.NumberFormatException: For input string: "N"
因为mybatis映射文件,是使用的ognl表达式,所以会把‘Y'解析为char,java是强类型的语言,不能这样写,正确写法:
<if test="flag == 'N'.toString()">
AND cust.certificate_no NOT IN (#{idCards})
</if>
或者<if test='flag == "N"'>
AND cust.certificate_no NOT IN (#{idCards})
</if>
阅读全文
0 0
- mybatis中判断字符串
- mybatis中if标签判断字符串相等
- mybatis-字符串判断
- Mybatis if 判断字符串
- Mybatis中 if test 判断数值字符串注意项
- mybatis if字符串相等判断。。
- mybatis 判断字符串是否相等
- Mybatis中xml判断字符串不为空和null简单方法
- MyBatis if test 字符串判断问题
- 关于mybatis传递string字符串判断
- MyBatis if test 字符串判断问题
- mybatis 在if 里判断字符串
- mybatis if标签判断字符串相等
- mybatis 用if标签判断字符串相等
- mybatis if test 字符串判断问题
- Mybatis中字符串替换问题
- 判断字符串中含有字母
- 在字符串中判断汉字
- CC26XX的RTOS定时器任务的建立。
- 多线程四.三-------不同锁的功能和使用
- Mybatis 框架使用的最核心内容(一):Mybatis的特点和映射管理
- h2o.ai源码解析(2)—启动流程
- 超级强大的SVG SMIL animation动画详解
- mybatis中判断字符串
- nextElementSibling 属性
- lambda表达式的简单实现
- LR进阶之softmax regression(含具体梯度推导)
- 网络是怎样连接的学习笔记(五)
- Eclipse+Jrebel实现web项目热部署
- Mybatis 框架使用的最核心内容(二):mapper.xml中常用的标签详解
- Spring10种常见异常解决方法
- 深入理解Java:SimpleDateFormat安全的时间格式化