source is null for getProperty(null, "cpmodel")异常结局
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'requestMap.cpmodel != null and requestMap.cpmodel != '''. Cause: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "cpmodel")
问题出现的愿意:我在mapper.xml中的查询方法中<if></if>中的test里使用了requestMap
代码如下:
<select id="countdoid" resultMap="detailsout">
select count(doid) from details_out,orders_need_supplyofgoods_details,position,orders_need,product,customer
where orders_need_supplyofgoods_details.status != 6
AND details_out.positionid = position.positionid
AND orders_need_supplyofgoods_details.nid = orders_need.nid
AND orders_need.cpid = product.cpid
AND position.cid = customer.cid
AND details_out.onsdid = orders_need_supplyofgoods_details.onsdid
<if test="requestMap.cpmodel != null and requestMap.cpmodel != ''">
AND product.cpmodel = #{requestMap.cpmodel}
</if>
<if test="requestMap.cname != null and requestMap.cname != ''">
AND customer.cname = #{requestMap.cname}
</if>
<if test="requestMap.weiyibiaoshi != null and requestMap.weiyibiaoshi != ''">
AND orders_need_supplyofgoods_details.weiyibiaoshi = #{requestMap.weiyibiaoshi}
</if>
<if test="requestMap.status != null and requestMap.status != ''">
AND orders_need_supplyofgoods_details.status = #{requestMap.status}
</if>
</select>
问题解决:我在mapper层中的方法里没有添加@Param("requestMap")Map<String, Object> requestMap,
解决方法:
/**
*
* @Title: countdoid
* @Description: TODO(物资闲置,计算已分发物资的数量)
* @return
*/
int countdoid();
添加参数后为
/**
*
* @Title: countdoid
* @Description: TODO(物资闲置,计算已分发物资的数量)
* @return
*/
int countdoid(@Param("requestMap")Map<String, Object> requestMap);
这样在mapper.xml的语句中就不会出问题了
source is null for getProperty(null, "cpmodel")异常结局的更多相关文章
- root cause org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "XXX")
在执行一个查询语句的时候,mybatis报错:root cause org.apache.ibatis.ognl.OgnlException: source is null for getProper ...
- org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "enterpCd")-Mybatis报错
一.问题由来 下午快要下班时,登录测试服务器查看日志信息,看看有没有新的异常信息,如果有的话好及时修改.结果一看果然有新的异常信息. 主要的异常信息如下: 2020-10-13 14:51:03,03 ...
- Caused by: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "mil_id")
今天在使用mybatis处理数据库的时候,突然抛出了上述异常,让我感到很惊讶,因为在处理save的时候,在Mybatis的配置文件中,我根本就没有使用到ognl表达式,系统怎么会抛出上述异常.而且之前 ...
- 解决 Illegal DefaultValue null for parameter type integer 异常
该异常是由 swagger 引起的 swagger 版本 1.9.2 解决原因:重新导入 swagger-annotations 和 swagger-models 版本 为 1.5.21 pom.xm ...
- Python使用import导入模块时报ValueError: source code string cannot contain null bytes的解决方案
老猿在导入一个Python模块时报错: >>> import restartnet.py Traceback (most recent call last): File " ...
- ognl.OgnlException: target is null for setProperty(null, "emailTypeNo", [Ljava.lang.String;@1513fd0)
[com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'emaiTypeDto.emailTypeNo' w ...
- 原!! java直接打印一个对象时,并不是直接调用该类的toString方法 ,而是会先判断是否为null,非null才会调用toString方法
网上看了好多java直接打印一个对象时,直接调用该类的toString方法 . 但是: Object obj=null; System.out.println(obj);//没有报错 System.o ...
- 关于ognl.OgnlException: target is null for setProperty(null的解决方案
在跑struts2的时候有时候会出现上面的错,特别是新手, 这种情况是在struts2高级的POJO访问时候出现的s 警告: Error setting expression 'user.passwo ...
- 了不起的 “filter(NULL IS NOT NULL)”
经常会在执行计划中看到很奇怪的"FILTER"操作,然后看对应的执行信息是"filter(NULL IS NOT NULL)". 其实这是优化器非常聪明的“短 ...
随机推荐
- Appium python自动化测试系列之移动自动化测试前提(一)
1.1 移动自动化测试现状 因为软件行业越来越发达,用户的接受度也在不断提高,所以对软件质量的要求也随之提高,当然这个也要分行业,但这个还是包含了大部分.因为成本.质量的变化现在对自动化测试的重视度越 ...
- HTML5之appcache语法理解/HTML5应用程序缓存/manifest缓存文件官方用法翻译
习惯性的贴几个参考链接: W3School-HTML 5 应用程序缓存 官方 MDN window.applicationCache 接口文档 官方 MDN 用法示例 看所有的教程不如直接看最原始的官 ...
- MySQL比like语句更高效的写法locate position instr find_in_set
使用内部函数instr,可代替传统的like方式查询,并且速度更快. instr函数,第一个参数是字段,第二个参数是要查询的串,返回串的位置,第一个是1,如果没找到就是0. 例如, select na ...
- LINUX 笔记-rm命令
常用参数: -f :就是force的意思,忽略不存在的文件,不会出现警告消息 -i :互动模式,在删除前会询问用户是否操作 -r :递归删除,最常用于目录删除,它是一个非常危险的参数
- [ACdream]瑶瑶带你玩激光坦克
题目链接:http://acdream.info/contest?cid=1269#problem-B Problem Description 有一款名为激光坦克的游戏,游戏规则是用一个坦克发出激光来 ...
- Javascript里的if判断与逻辑运算符(||, &&)和比较运算符的特别之处
写JS时不可避免要用到 if 与 逻辑运算符( ||, &&). 如果你经常阅读Js的第三方组件源码, 会发现有一种写法作为初始化变量的方法经常出现. var variable = v ...
- 数据帧CRC32校验算法实现
本文设计思想采用明德扬至简设计法.由于本人项目需要进行光纤数据传输,为了保证通信质量要对数据进行校验.在校验算法中,最简单最成熟的非CRC校验莫属了. 得出一个数的CRC校验码还是比较简单的: 选定一 ...
- Yii2之组件的注册与创建
今天本来打算研究一下yii2.0的AR模型的实现原理,然而,计划赶不上变化,突然就想先研究一下yii2.0的数据库组件创建的过程.通过对yii源码的学习,了解了yii组件注册与创建的过程,并发现原来y ...
- LeetCode 695. Max Area of Island (岛的最大区域)
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) conn ...
- inline的C99标准相关原文
WG14/N1256 Annex J (informative) Portability issues J.1 Unspecified behavior Whether a call to an in ...