zoukankan      html  css  js  c++  java
  • 当传入数据只有一个时mybatis中<if>判断会出现There is no getter for property named 'subjectId' in 'class java.lang.Integer

    用"_parameter"代替当前参数

    正确:

    复制代码
    <select id="selectSubjectByPId"  parameterType="java.lang.Integer" resultType="java.util.Map">
            select subjectId,subjectName 
            from ts_subject 
            where subjectParentId= 0 
            <if test="_parameter != null">
                and subjectId = #{_parameter,jdbcType=INTEGER}
            </if>
    </select>
    复制代码

    错误:

    复制代码
    <select id="selectSubjectByPId"  parameterType="java.lang.Integer" resultType="java.util.Map">
            select subjectId,subjectName 
            from ts_subject 
            where subjectParentId= 0 
            <if test="subjectId != null">
                and subjectId = #{subjectId,jdbcType=INTEGER}
            </if>
    </select>
    复制代码

    这时候就会出现异常.

    There is no getter for property named 'subjectId' in 'class java.lang.Intege
  • 相关阅读:
    图论初步
    分块和块状链表
    线段树入门
    ST表与树状数组
    [luogu P1312]Mayan游戏
    [luoguP4139]上帝与集合的正确用法


    电解质
    无机盐
  • 原文地址:https://www.cnblogs.com/taiyanhong/p/7515130.html
Copyright © 2011-2022 走看看