随笔 - 20  文章 - 0  评论 - 0  阅读 - 6998

记录前台后台交互时关于日期的类型转换异常

 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.String
### Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.String] with root cause

这是前后台交互的时候产生的类型转换异常报错原因是我在写sql xml 文件时的报错

 <if test="vo.start != null and vo.start != ''">
                    and s.birth >= #{vo.start}
                </if>

在if判断中我写时间类型  !=' '  导致的类型转换的报错

 <if test="vo.start != null ">
                    and s.birth >= #{vo.start}
                </if>

这样再进行查询就可以查出数据了

posted on   菊_酒  阅读(52)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

欢迎阅读『记录前台后台交互时关于日期的类型转换异常』
点击右上角即可分享
微信分享提示