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")异常结局的更多相关文章

  1. 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 ...

  2. org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "enterpCd")-Mybatis报错

    一.问题由来 下午快要下班时,登录测试服务器查看日志信息,看看有没有新的异常信息,如果有的话好及时修改.结果一看果然有新的异常信息. 主要的异常信息如下: 2020-10-13 14:51:03,03 ...

  3. Caused by: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "mil_id")

    今天在使用mybatis处理数据库的时候,突然抛出了上述异常,让我感到很惊讶,因为在处理save的时候,在Mybatis的配置文件中,我根本就没有使用到ognl表达式,系统怎么会抛出上述异常.而且之前 ...

  4. 解决 Illegal DefaultValue null for parameter type integer 异常

    该异常是由 swagger 引起的 swagger 版本 1.9.2 解决原因:重新导入 swagger-annotations 和 swagger-models 版本 为 1.5.21 pom.xm ...

  5. Python使用import导入模块时报ValueError: source code string cannot contain null bytes的解决方案

    老猿在导入一个Python模块时报错: >>> import restartnet.py Traceback (most recent call last): File " ...

  6. ognl.OgnlException: target is null for setProperty(null, "emailTypeNo", [Ljava.lang.String;@1513fd0)

    [com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'emaiTypeDto.emailTypeNo' w ...

  7. 原!! java直接打印一个对象时,并不是直接调用该类的toString方法 ,而是会先判断是否为null,非null才会调用toString方法

    网上看了好多java直接打印一个对象时,直接调用该类的toString方法 . 但是: Object obj=null; System.out.println(obj);//没有报错 System.o ...

  8. 关于ognl.OgnlException: target is null for setProperty(null的解决方案

    在跑struts2的时候有时候会出现上面的错,特别是新手, 这种情况是在struts2高级的POJO访问时候出现的s 警告: Error setting expression 'user.passwo ...

  9. 了不起的 “filter(NULL IS NOT NULL)”

    经常会在执行计划中看到很奇怪的"FILTER"操作,然后看对应的执行信息是"filter(NULL IS NOT NULL)".  其实这是优化器非常聪明的“短 ...

随机推荐

  1. linux安装禅道的步骤

    linux一键安装禅道:1.禅道帮助文档:http://www.zentao.net/book/zentaopmshelp/90.html 2.修改Apache的端口号:/opt/zbox/zbox ...

  2. Java 线程并发

    http://www.yesky.com/9/1899009.shtml http://zhidao.baidu.com/link?url=-xZ9JLo5x4bvCSVyXb2XhO6TODnBcU ...

  3. win10 UWP 序列化

    将对象的状态信息转换为可以存储或传输的形式的过程.在序列化期间,对象将其当前状态写入到临时或持久性存储区.以后,可以通过从存储区中读取或反序列化对象的状态,重新创建该对象. .NET Framewor ...

  4. Spring4.0.1+Quartz2.2.1实现定时任务调度[亲测可用]

    Spring4.0.1+Quartz2.2.1实现定时任务调度[亲测可用] tip:只需要配置xml文件即可 1.第三方依赖包的引入 <properties> <project.bu ...

  5. [机房练习赛7.26] YYR字符串

    1  无尽的矩阵(matrix.c/cpp/pas) 1.1  题目描述 从前有一个的小矩阵,矩阵的每个元素是一个字母(区分大小写),突然有一天它发生了变异,覆盖了整个二维空间,即不停自我复制产生相同 ...

  6. 新博客,新开始-从Chrome浏览器奔溃说起

    新博客,新开始 今天是2015-04-09,昨天新开的博客,今天在这写上一段,算是立个标记,好留以后拿来回溯吧. 不知道是谁跟我说的,坚持写博客是个好习惯,也能帮助自己总结经验,提高技术.也许大概可能 ...

  7. 使用vim编写hexo文档,并用ultisnips/snipmates/snippets插件补全

    作为一个vim使用者,编写markdown文档时若不能用vim这怎么能受的了! 下面是我编写markdown的时候用到的插件 Plugin 'Markdown'Plugin 'Markdown-syn ...

  8. 浅试 Webview 一app 加载 H5小游戏

    整体架构: InventionActivity:实现UI的实例化,基本的按钮Activity之间跳转 GameActivity:实现UI的实例化,Webview的基本使用 MyProgressDial ...

  9. spring MVC 环境搭建

    绿色版Spring MVC(单纯的springMVC) 一.导包,为了获取请求数据多添加一个包 二.web.xml配置 <?xml version="1.0" encodin ...

  10. typeof、constructor和instance

    在JavaScript中,我们经常使用typeof来判断一个变量的类型,使用格式为:typeof(data)或typeof data.typeof返回的数据类型有六种:number.string.bo ...