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. PHP-FPM进程池探秘

    PHP 支持多进程而不支持多线程:PHP-FPM 在进程池中运行多个子进程并发处理所有连接请求.通过 ps 查看PHP-FPM进程池(pm.start_servers = 2)状态如下: root@d ...

  2. jenkins、ant、selenium、testng搭建自动化测试框架

    如果在你的理解中自动化测试就是在eclipse里面讲webdriver的包引入,然后写一些测试脚本,这就是你所说的自动化测试,其实这个还不能算是真正的自动化测试,你见过每次需要运行的时候还需要打开ec ...

  3. 转:扩展方法(C# 编程指南)

    扩展方法使你能够向现有类型“添加”方法,而无需创建新的派生类型.重新编译或以其他方式修改原始类型.扩展方法是一种特殊的静态方法,但可以像扩展类型上的实例方法一样进行调用.对于用 C# 和 Visual ...

  4. Guava快速入门

    Guava快速入门 Java诞生于1995年,在这20年的时间里Java已经成为世界上最流行的编程语言之一.虽然Java语言时常经历各种各样的吐槽,但它仍然是一门在不断发展.变化的语言--除了语言本身 ...

  5. win10 uwp 模拟网页输入

    有时候需要获得网页的 js 执行后的源代码,或者模拟网页输入,如点按钮输入文字. 如果需要实现,那么就需要用 WebView ,使用方法很简单. 首先创建一个 WebView ,接下来的所有输入都需要 ...

  6. WordPress 4.8 安装配置教程 (基于 centos 7.3, php 7.0, mysql 5.7.19, nginx 1.12.1)

    最近想要整个 blog,记录自己工作.学习中的点滴.Wordpress 自然是首选,因为内容才是关键,所以也就不怕别人说太 low.网上大部份都是讲 wordpress 配合 apache 的安装教程 ...

  7. Cosmos OpenSSD--greedy_ftl1.2.0(一)

    从主函数跳到ReqHandler,在ReqHandler内先初始化SSD--InitNandReset,然后建立映射表InitFtlMapTable void InitNandReset() { // ...

  8. tamcat的使用

    tomcat的基础知识 一.tomcat的定义 apache的官网是这么说的:使用Apache Tomcat ®软件了Java Servlet,JavaServer页,Java表达式语言和Java的W ...

  9. LAMP 实现全过程及wordpress的搭建

    一.介绍 1. LAM(M)P: L:linux A:apache (httpd) M:mysql, mariadb M:memcached 缓存 P:php, perl, python WEB 资源 ...

  10. 使用angular4和asp.net core 2 web api做个练习项目(二), 这部分都是angular

    上一篇: http://www.cnblogs.com/cgzl/p/7755801.html 完成client.service.ts: import { Injectable } from '@an ...