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. Pyquery API中文版

    Pyquery的用法与jQuery相同,可以直接参考jQuery API学习.

  2. NOIP2015运输计划(树上前缀和+LCA+二分)

    Description 公元 2044 年,人类进入了宇宙纪元. L 国有 n 个星球,还有 n−1 条双向航道,每条航道建立在两个星球之间,这 n−1 条航道连通了 L 国的所有星球. 小 P 掌管 ...

  3. ajax 轮询 和 php长连接

     只看加粗的字体 js   部分       1:  ajax 成功回调函数中 一定要用时间函数间隔调用  get_comment(). get_comments('init'); function ...

  4. clone对象

    在JavaScript中,当对象作为参数传给函数的时候,在函数内部对这个对象的属性进行修改时,函数外部的对象属性也会跟着被修改,而有些时候我们并不想原来的对象数据发生改变,这时候就需要切断对象之间的引 ...

  5. BZOJ-1225-[HNOI2001] 求正整数

    Description 对于任意输入的正整数n,请编程求出具有n个不同因子的最小正整数m.例如:n=4,则m=6,因为6有4个不同整数因子1,2,3,6:而且是最小的有4个因子的整数. Input n ...

  6. python 带小数点时间格式化

    #获取带小数点的时间>>> import datetime #当前时间加3天 >>> t1 = datetime.datetime.now() + datetime ...

  7. SEO诊断之关于网站收录(转)

    如何让网站被搜索引擎收录?我的网站有收录无排名怎么办?这些网站收录问题估计是seo最应关心的根本问题之一,网站收录都没有何来排名?我整理了每天咨询最多最具代表性的 8 个关于网站收录的问题及其答案统一 ...

  8. 使用angular4和asp.net core 2 web api做个练习项目(四)

    第一部分: http://www.cnblogs.com/cgzl/p/7755801.html 第二部分: http://www.cnblogs.com/cgzl/p/7763397.html 第三 ...

  9. Leetcode题解(十)

    29.Divide Two Integers 题目 题目要求不用乘除和取模运算,实现两个整数相除: 我的第一想法就是把除法变成减法来做,这也是最初除法的定义,其实现代码如下: class Soluti ...

  10. 桌面消息通知:HTML5 Notification

    先上一段完整代码 //注册权限 Notification.requestPermission(function (status) { // 这将使我们能在 Chrome/Safari 中使用 Noti ...